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

Class IP3366Crawler

proxypool/crawlers/public/ip3366.py:10–26  ·  view source on GitHub ↗

ip3366 crawler, http://www.ip3366.net/

Source from the content-addressed store, hash-verified

8
9
10class IP3366Crawler(BaseCrawler):
11 """
12 ip3366 crawler, http://www.ip3366.net/
13 """
14 urls = [BASE_URL.format(stype=stype,page=i) for stype in range(1,3) for i in range(1, 8)]
15
16 def parse(self, html):
17 """
18 parse html file to get proxies
19 :return:
20 """
21 ip_address = re.compile('<tr>\s*<td>(.*?)</td>\s*<td>(.*?)</td>')
22 # \s * 匹配空格,起到换行作用
23 re_ip_address = ip_address.findall(html)
24 for address, port in re_ip_address:
25 proxy = Proxy(host=address.strip(), port=int(port.strip()))
26 yield proxy
27
28
29if __name__ == '__main__':

Callers 1

ip3366.pyFile · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected