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

Method parse

proxypool/crawlers/public/uqidata.py:24–43  ·  view source on GitHub ↗

parse html file to get proxies :return:

(self, html)

Source from the content-addressed store, hash-verified

22 return result
23
24 def parse(self, html):
25 """
26 parse html file to get proxies
27 :return:
28 """
29 doc = pq(html)
30 trs = doc('#main_container .inner table tbody tr:nth-child(n+3)').items()
31 for tr in trs:
32 ip_html = tr('td.ip').find("*").items()
33 host = ''
34 for i in ip_html:
35 if i.attr('style') is not None and 'none' in i.attr('style'):
36 continue
37 if i.text() == '':
38 continue
39 host += i.text()
40
41 port_code = tr('td.port').attr('class').split(' ')[1]
42 port = UqidataCrawler.encode(port_code)
43 yield Proxy(host=host, port=port)
44
45
46if __name__ == '__main__':

Callers

nothing calls this directly

Calls 2

ProxyClass · 0.90
encodeMethod · 0.80

Tested by

no test coverage detected