You can use BuildProxiedSession to scrape proxies from various sources. By specifying a type (the source name) and configuration like max_pages, you can retrieve a list of ProxyInfo objects. This allows you to aggregate proxies from multiple providers, summarize their statistics (protocol distribution, anonymity, etc.), and save them to a JSON file using the todict() method on each proxy object.
import json
from freeproxy.modules import BuildProxiedSession
# Example: Scrape from a specific source
# 'type' corresponds to the registered module name
sess = BuildProxiedSession({"max_pages": 1, "type": "ProxiflyProxiedSession", "disable_print": False})
proxies = sess.refreshproxies()
# Save to JSON
free_proxies = {src: [p.todict() for p in proxies] for src in ["ProxiflyProxiedSession"]}
with open("free_proxies.json", "w") as f:
json.dump(free_proxies, f, indent=2)