ip yqie crawler, http://ip.yqie.com/ipproxy.htm
| 8 | |
| 9 | |
| 10 | class YqIeCrawler(BaseCrawler): |
| 11 | """ |
| 12 | ip yqie crawler, http://ip.yqie.com/ipproxy.htm |
| 13 | """ |
| 14 | urls = [BASE_URL] |
| 15 | |
| 16 | def parse(self, html): |
| 17 | """ |
| 18 | parse html file to get proxies |
| 19 | :return: |
| 20 | """ |
| 21 | doc = pq(html) |
| 22 | trs = doc('#GridViewOrder tr:gt(0)').items() |
| 23 | for tr in trs: |
| 24 | host = tr.find('td:nth-child(1)').text() |
| 25 | port = int(tr.find('td:nth-child(2)').text()) |
| 26 | yield Proxy(host=host, port=port) |
| 27 | |
| 28 | |
| 29 | if __name__ == '__main__': |