from flask import Flask, render_template, request import requests app = Flask(__name__) # List of free public SOCKS5 proxies. # You can update this list from free proxy sources periodically. proxies_list = [ "socks5h://104.248.63.15:30588", "socks5h://149.154.159.5:1080", "socks5h://165.231.86.172:9050", # ...add more if needed ] def get_working_proxy(): for proxy in proxies_list: try: r = requests.get("https://httpbin.org/ip", proxies={"http": proxy, "https": proxy}, timeout=5) if r.status_code == 200: return proxy except: continue return None @app.route('/', methods=['GET', 'POST']) def home(): url = '' content = '' error = '' if request.method == 'POST': url = request.form.get('url') if not url.startswith(("http://", "https://")): url = "http://" + url proxy = get_working_proxy() if not proxy: error = "No working free SOCKS5 proxy found. Try again later." else: try: r = requests.get(url, proxies={"http": proxy, "https": proxy}, timeout=10) r.raise_for_status() content = r.text except Exception as e: error = f"Error fetching URL via proxy {proxy}: {e}" return render_template('index.html', url=url, content=content, error=error) if __name__ == '__main__': app.run(host="0.0.0.0", port=7860)