|
@@ -164,10 +164,15 @@ class ProxyFetcher(object):
|
|
|
"""
|
|
"""
|
|
|
快代理 https://www.kuaidaili.com
|
|
快代理 https://www.kuaidaili.com
|
|
|
"""
|
|
"""
|
|
|
- url_list = [
|
|
|
|
|
- 'https://www.kuaidaili.com/free/inha/',
|
|
|
|
|
- 'https://www.kuaidaili.com/free/intr/'
|
|
|
|
|
|
|
+ url_pattern = [
|
|
|
|
|
+ 'https://www.kuaidaili.com/free/inha/{}/',
|
|
|
|
|
+ 'https://www.kuaidaili.com/free/intr/{}/'
|
|
|
]
|
|
]
|
|
|
|
|
+ url_list = []
|
|
|
|
|
+ for page_index in range(1, 3):
|
|
|
|
|
+ for pattern in url_pattern:
|
|
|
|
|
+ url_list.append(pattern.format(page_index))
|
|
|
|
|
+
|
|
|
for url in url_list:
|
|
for url in url_list:
|
|
|
tree = WebRequest().get(url).tree
|
|
tree = WebRequest().get(url).tree
|
|
|
proxy_list = tree.xpath('.//table//tr')
|
|
proxy_list = tree.xpath('.//table//tr')
|
|
@@ -229,7 +234,7 @@ class ProxyFetcher(object):
|
|
|
:return:
|
|
:return:
|
|
|
"""
|
|
"""
|
|
|
for i in range(1, page_count + 1):
|
|
for i in range(1, page_count + 1):
|
|
|
- url = 'http://ip.jiangxianli.com/?country=中国&?page={}'.format(i)
|
|
|
|
|
|
|
+ url = 'http://ip.jiangxianli.com/?country=中国&page={}'.format(i)
|
|
|
html_tree = WebRequest().get(url).tree
|
|
html_tree = WebRequest().get(url).tree
|
|
|
for index, tr in enumerate(html_tree.xpath("//table//tr")):
|
|
for index, tr in enumerate(html_tree.xpath("//table//tr")):
|
|
|
if index == 0:
|
|
if index == 0:
|