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

Class IPHaiCrawler

proxypool/crawlers/public/iphai.py:8–29  ·  view source on GitHub ↗

iphai crawler, http://www.iphai.com/

Source from the content-addressed store, hash-verified

6BASE_URL = 'http://www.iphai.com/'
7
8class IPHaiCrawler(BaseCrawler):
9 """
10 iphai crawler, http://www.iphai.com/
11 """
12 urls = [BASE_URL]
13 ignore = True
14
15 def parse(self, html):
16 """
17 parse html file to get proxies
18 :return:
19 """
20 find_tr = re.compile('<tr>(.*?)</tr>', re.S)
21 trs = find_tr.findall(html)
22 for s in range(1, len(trs)):
23 find_ip = re.compile('<td>\s+(\d+\.\d+\.\d+\.\d+)\s+</td>', re.S)
24 re_ip_address = find_ip.findall(trs[s])
25 find_port = re.compile('<td>\s+(\d+)\s+</td>', re.S)
26 re_port = find_port.findall(trs[s])
27 for address, port in zip(re_ip_address, re_port):
28 proxy = Proxy(host=address.strip(), port=int(port.strip()))
29 yield proxy
30
31if __name__ == '__main__':
32 crawler = IPHaiCrawler()

Callers 1

iphai.pyFile · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected