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}")