66 lines
2.1 KiB
Python
Executable File
66 lines
2.1 KiB
Python
Executable File
#!/usr/bin/env python3
|
|
"""
|
|
Pull fresh proxies from GitHub free lists.
|
|
Sources: proxifly (every 5min), fyvri (hourly), vakhov (daily)
|
|
|
|
Usage: python proxy_fetcher.py [--output proxies.txt] [--check]
|
|
"""
|
|
import sys
|
|
import requests
|
|
|
|
SOURCES = {
|
|
"proxifly_http": "https://raw.githubusercontent.com/proxifly/free-proxy-list/main/proxies/protocols/http/data.txt",
|
|
"proxifly_socks4": "https://raw.githubusercontent.com/proxifly/free-proxy-list/main/proxies/protocols/socks4/data.txt",
|
|
"proxifly_socks5": "https://raw.githubusercontent.com/proxifly/free-proxy-list/main/proxies/protocols/socks5/data.txt",
|
|
"fyvri": "https://raw.githubusercontent.com/fyvri/fresh-proxy-list/main/proxies.txt",
|
|
"vakhov": "https://vakhov.github.io/fresh-proxy-list/proxies.txt",
|
|
}
|
|
|
|
HEADERS = {
|
|
"User-Agent": "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36"
|
|
}
|
|
|
|
|
|
def fetch_all():
|
|
all_proxies = set()
|
|
for name, url in SOURCES.items():
|
|
try:
|
|
r = requests.get(url, headers=HEADERS, timeout=15)
|
|
if r.status_code == 200:
|
|
proxies = [p.strip() for p in r.text.splitlines() if p.strip() and not p.startswith("#")]
|
|
all_proxies.update(proxies)
|
|
print(f" ✅ {name}: {len(proxies)} proxies")
|
|
else:
|
|
print(f" ❌ {name}: HTTP {r.status_code}")
|
|
except Exception as e:
|
|
print(f" ❌ {name}: {e}")
|
|
return sorted(all_proxies)
|
|
|
|
|
|
def main():
|
|
outfile = "proxies.txt"
|
|
do_check = False
|
|
|
|
args = sys.argv[1:]
|
|
for i, arg in enumerate(args):
|
|
if arg == "--output" and i + 1 < len(args):
|
|
outfile = args[i + 1]
|
|
elif arg == "--check":
|
|
do_check = True
|
|
|
|
print(f"🔥 Fetching free proxies from {len(SOURCES)} sources...\n")
|
|
proxies = fetch_all()
|
|
|
|
with open(outfile, "w") as f:
|
|
f.write("\n".join(proxies))
|
|
|
|
print(f"\n📦 Total unique: {len(proxies)} → {outfile}")
|
|
|
|
if do_check:
|
|
print(f"\n🔍 Running proxy checker...")
|
|
import subprocess
|
|
subprocess.run([sys.executable, "proxy_checker.py", outfile, "--workers", "30"])
|
|
|
|
|
|
if __name__ == "__main__":
|
|
main() |