陈德本 пре 5 година
родитељ
комит
ad71acb2f1
3 измењених фајлова са 17 додато и 28 уклоњено
  1. 5 4
      fetcher/proxyFetcher.py
  2. 1 1
      setting.py
  3. 11 23
      test.py

+ 5 - 4
fetcher/proxyFetcher.py

@@ -12,7 +12,6 @@
 """
 import base64
 
-
 __author__ = 'JHao'
 
 import re
@@ -285,17 +284,19 @@ class ProxyFetcher(object):
 
     @staticmethod
     def freeProxy15():
-        urls=[
+        urls = [
             'https://www.xroxy.com/proxylist.php?port=&type=All_http&ssl=&country=&latency=&reliability=#table',
             'https://www.xroxy.com/proxylist.php?port=&type=All_http&ssl=&country=&latency=&reliability=&sort=reliability&desc=true&pnum=1#table',
             'https://www.xroxy.com/proxylist.php?port=&type=All_http&ssl=&country=&latency=&reliability=&sort=reliability&desc=true&pnum=2#table',
             'https://www.xroxy.com/proxylist.php?port=&type=All_http&ssl=&country=&latency=&reliability=&sort=reliability&desc=true&pnum=3#table',
             'https://www.xroxy.com/proxylist.php?port=&type=All_http&ssl=&country=&latency=&reliability=&sort=reliability&desc=true&pnum=4#table',
         ]
+        _proxies = {'http': 'http://myhome.97admin.com:34185', 'https': 'http://myhome.97admin.com:34185'}
+
         for url in urls:
-            r = WebRequest().get(url, timeout=10)
+            r = WebRequest().get(url, timeout=10, proxies=_proxies)
             proxies = re.findall(
                 r'<td.*?>[\s\S]*?(\d{1,3}\.\d{1,3}\.\d{1,3}\.\d{1,3})[\s\S]*?</td>[\s\S]*?<td.*?>[\s\S]*?(\d+)[\s\S]*?</td>',
                 r.text)
             for proxy in proxies:
-                yield ':'.join(proxy)
+                yield ':'.join(proxy)

+ 1 - 1
setting.py

@@ -50,7 +50,7 @@ PROXY_FETCHER = [
     # "freeProxy03",
     "freeProxy04",
     "freeProxy05",
-    "freeProxy06",
+    # "freeProxy06",
     "freeProxy07",
     # "freeProxy08",
     "freeProxy09",

+ 11 - 23
test.py

@@ -1,27 +1,15 @@
-# -*- coding: utf-8 -*-
-"""
--------------------------------------------------
-   File Name:     test.py  
-   Description :  
-   Author :       JHao
-   date:          2017/3/7
--------------------------------------------------
-   Change Activity:
-                   2017/3/7: 
--------------------------------------------------
-"""
-__author__ = 'JHao'
+import requests
 
-from test import testConfigHandler
-from test import testLogHandler
-from test import testDbClient
+url = "http://free-proxy.cz/zh/proxylist/country/all/http/ping/all/2"
 
-if __name__ == '__main__':
-    print("ConfigHandler:")
-    testConfigHandler.testConfig()
+payload={}
+headers = {
+  'DNT': '1',
+  'Upgrade-Insecure-Requests': '1',
+  'User-Agent': 'Mozilla/5.0 (Macintosh; Intel Mac OS X 10_14_6) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/87.0.4280.141 Safari/537.36',
+  'Referer': 'http://free-proxy.cz/zh/proxylist/country/all/http/ping/all'
+}
 
-    print("LogHandler:")
-    testLogHandler.testLogHandler()
+response = requests.request("GET", url, headers=headers, data=payload)
 
-    print("DbClient:")
-    testDbClient.testDbClient()
+print(response.text)