MCPcopy Create free account
hub / github.com/Python3WebSpider/ProxyPool / IhuanCrawler

Class IhuanCrawler

proxypool/crawlers/public/ihuan.py:9–30  ·  view source on GitHub ↗

ip ihuan crawler, https://ip.ihuan.me

Source from the content-addressed store, hash-verified

7
8
9class IhuanCrawler(BaseCrawler):
10 """
11 ip ihuan crawler, https://ip.ihuan.me
12 """
13 path = time.strftime("%Y/%m/%d/%H", time.localtime())
14 urls = [BASE_URL.format(path=path)]
15 ignore = False
16
17 def parse(self, html):
18 """
19 parse html file to get proxies
20 :return:
21 """
22 # doc = pq(html)('.text-left')
23 ip_address = re.compile('([\d:\.]*).*?<br>')
24 hosts_ports = ip_address.findall(html)
25 for addr in hosts_ports:
26 addr_split = addr.split(':')
27 if(len(addr_split) == 2):
28 host = addr_split[0]
29 port = addr_split[1]
30 yield Proxy(host=host, port=port)
31
32
33if __name__ == '__main__':

Callers 1

ihuan.pyFile · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected