-
Notifications
You must be signed in to change notification settings - Fork 5.4k
Expand file tree
/
Copy pathgeonode.py
More file actions
49 lines (41 loc) · 1.5 KB
/
Copy pathgeonode.py
File metadata and controls
49 lines (41 loc) · 1.5 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
# -*- coding: utf-8 -*-
"""
-------------------------------------------------
File Name: geonode.py
Description : Geonode代理源
Author : JHao
date: 2026/5/31
-------------------------------------------------
Change Activity:
2026/05/31:
-------------------------------------------------
"""
__author__ = 'JHao'
from fetcher.baseFetcher import BaseFetcher
from handler.logHandler import LogHandler
from util.webRequest import WebRequest
logger = LogHandler("fetcher")
class GeonodeFetcher(BaseFetcher):
"""Geonode Free Proxy https://geonode.com/"""
name = "geonode"
url = "https://geonode.com/"
def fetch(self):
url = ("https://proxylist.geonode.com/api/proxy-list?"
"filterLastChecked=10&page=1&limit=100&sort_by=lastChecked&sort_type=desc")
r = WebRequest().get(url, timeout=5, retry_time=1, verify=False)
try:
proxies = []
for item in r.json.get("data", []):
ip = item.get("ip", "")
port = item.get("port", "")
if ip and port:
proxies.append("%s:%s" % (ip, port))
if not proxies:
proxies = self.parseProxiesFromText(r.text)
for proxy in self.yieldUniqueProxies(proxies):
yield proxy
except Exception as e:
logger.error("ProxyFetch - geonode: %s" % e)
if __name__ == '__main__':
for proxy in GeonodeFetcher().fetch():
print(proxy)