File size: 969 Bytes
27d84b1
6f1c0f1
27d84b1
1eb61e8
3c5b0d6
27d84b1
 
3c5b0d6
 
 
27d84b1
3c5b0d6
27d84b1
25e6bf6
27d84b1
 
 
3c5b0d6
27d84b1
3c5b0d6
27d84b1
 
3c5b0d6
d9785ef
3c5b0d6
27d84b1
3c5b0d6
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
import dns.resolver
import requests
import socket

# Manually resolve the DNS to an IP address using a specific DNS server
def resolve_hostname(hostname):
    resolver = dns.resolver.Resolver()
    resolver.nameservers = ['8.8.8.8', '1.1.1.1']  # Specify the DNS servers
    answers = resolver.resolve(hostname)
    return answers[0].address

# Replace the hostname in the URL with the resolved IP address
hostname = 'stremio-rev-proxy.h-y.workers.dev'
url = 'https://stremio-rev-proxy.h-y.workers.dev/https://example.com/'

try:
    ip_address = resolve_hostname(hostname)
    # Replace hostname in the URL with IP
    new_url = url.replace(hostname, ip_address)
    # You need to set the 'Host' header manually since you're using the IP
    headers = {'Host': hostname}
    
    # Make the request
    response = requests.get(new_url, headers=headers, verify = False)
    print(response.content)
except Exception as e:
    print(f"Failed to resolve or connect: {e}")