MCPcopy Index your code
hub / github.com/Python3WebSpider/ProxyPool / parse

Method parse

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

parse html file to get proxies :return:

(self, html)

Source from the content-addressed store, hash-verified

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

nothing calls this directly

Calls 1

ProxyClass · 0.90

Tested by

no test coverage detected