Download get_proxies_https.py from meccatronis/taobao_scraper: direct link, hf CLI and curl.
- Browser
- Download file 1.84 kB
-
https://huggingface.co/meccatronis/taobao_scraper/resolve/main/get_proxies_https.py
- Command line
-
hf download hf://meccatronis/taobao_scraper/get_proxies_https.py
-
curl -L -o get_proxies_https.py https://huggingface.co/meccatronis/taobao_scraper/resolve/main/get_proxies_https.py
1.84 kB
| #!/usr/bin/env python3 | |
| """ | |
| Busca proxies que suportam HTTPS | |
| """ | |
| import re | |
| import json | |
| import urllib.request | |
| def fetch(url): | |
| try: | |
| req = urllib.request.Request(url, headers={"User-Agent": "Mozilla/5.0"}) | |
| with urllib.request.urlopen(req, timeout=20) as resp: | |
| return resp.read().decode('utf-8', errors='ignore') | |
| except: | |
| return None | |
| # Tenta GeoNode com HTTPS | |
| print("🔍 Buscando proxies HTTPS/SOCKS5...") | |
| url = "https://proxylist.geonode.com/api/proxy-list?limit=100&country=cn&protocol=socks5&format=json" | |
| data = fetch(url) | |
| if data: | |
| result = json.loads(data) | |
| if isinstance(result, list): | |
| proxies = [] | |
| for item in result: | |
| if 'ip' in item and 'port' in item: | |
| proxies.append(f"socks5://{item['ip']}:{item['port']}") | |
| print(f"✅ {len(proxies)} SOCKS5 proxies encontrados") | |
| with open("/tmp/china_proxies_socks5.txt", "w") as f: | |
| for p in proxies[:20]: | |
| f.write(p + "\n") | |
| print(f"\n💾 Salvos em /tmp/china_proxies_socks5.txt") | |
| print(f"\nPrimeiros 5:") | |
| for p in proxies[:5]: | |
| print(f" {p}") | |
| else: | |
| print("❌ Falha ao buscar") | |
| # Tenta outra fonte | |
| print("\n🔍 Buscando HTTP proxies que podem suportar HTTPS...") | |
| url2 = "https://api.proxyscrape.com/v2/?request=getproxies&protocol=https&timeout=10000&country=cn&ssl=all&anonymity=elite" | |
| data2 = fetch(url2) | |
| if data2: | |
| lines = [l.strip() for l in data2.split('\n') if ':' in l] | |
| print(f"✅ {len(lines)} HTTPS proxies encontrados") | |
| with open("/tmp/china_proxies_https.txt", "w") as f: | |
| for l in lines[:20]: | |
| f.write(f"http://{l}\n") | |
| print(f"\n💾 Salvos em /tmp/china_proxies_https.txt") | |
| print(f"\nPrimeiros 5:") | |
| for l in lines[:5]: | |
| print(f" http://{l}") | |