From 3ccabd25309041d422cae97f5aecbf93303efd88 Mon Sep 17 00:00:00 2001 From: jhao Date: Tue, 3 Nov 2020 17:10:12 +0800 Subject: [PATCH 1/6] [update] show proxy count --- test/testProxyFetcher.py | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/test/testProxyFetcher.py b/test/testProxyFetcher.py index 7a782f705..a530b2e50 100644 --- a/test/testProxyFetcher.py +++ b/test/testProxyFetcher.py @@ -19,13 +19,14 @@ def testProxyFetcher(): conf = ConfigHandler() proxy_getter_functions = conf.fetchers + proxy_counter = {_: 0 for _ in proxy_getter_functions} for proxyGetter in proxy_getter_functions: - proxy_count = 0 for proxy in getattr(ProxyFetcher, proxyGetter.strip())(): if proxy: - print('{func}: fetch proxy {proxy},proxy_count:{proxy_count}'.format(func=proxyGetter, proxy=proxy, - proxy_count=proxy_count)) - proxy_count += 1 + print('{func}: fetch proxy {proxy}'.format(func=proxyGetter, proxy=proxy)) + proxy_counter[proxyGetter] = proxy_counter.get(proxyGetter) + 1 + for key, value in proxy_counter.items(): + print(key, value) if __name__ == '__main__': From 69e4f862fc0a847404fcef6e39ab13da9edd2b3b Mon Sep 17 00:00:00 2001 From: jhao Date: Wed, 4 Nov 2020 10:35:15 +0800 Subject: [PATCH 2/6] =?UTF-8?q?[update]=20=E4=BB=A3=E7=90=8666?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- fetcher/proxyFetcher.py | 47 ++++++----------------------------------- 1 file changed, 6 insertions(+), 41 deletions(-) diff --git a/fetcher/proxyFetcher.py b/fetcher/proxyFetcher.py index 71cf276b0..233cacbd1 100644 --- a/fetcher/proxyFetcher.py +++ b/fetcher/proxyFetcher.py @@ -54,52 +54,17 @@ def freeProxy01(): print(e) @staticmethod - def freeProxy02(count=20): + def freeProxy02(): """ 代理66 http://www.66ip.cn/ - :param count: 提取数量 :return: """ - urls = [ - "http://www.66ip.cn/mo.php?sxb=&tqsl={}&port=&export=&ktip=&sxa=&submit=%CC%E1++%C8%A1&textarea=", - "http://www.66ip.cn/nmtq.php?getnum={}&isp=0&anonymoustype=0&s" - "tart=&ports=&export=&ipaddress=&area=0&proxytype=2&api=66ip" - ] - - try: - import execjs - import requests - - headers = {'User-Agent': 'Mozilla/5.0 (Windows NT 6.1; WOW64; rv:34.0) Gecko/20100101 Firefox/34.0', - 'Accept': '*/*', - 'Connection': 'keep-alive', - 'Accept-Language': 'zh-CN,zh;q=0.8'} - session = requests.session() - src = session.get("http://www.66ip.cn/", headers=headers).text - src = src.split("")[0] + '}' - src = src.replace("