Explorar o código

添加一个代理网站
http://www.ip3366.net/free/

luocaodan %!s(int64=8) %!d(string=hai) anos
pai
achega
de58a7e81f
Modificáronse 2 ficheiros con 15 adicións e 3 borrados
  1. 1 0
      Config.ini
  2. 14 3
      ProxyGetter/getFreeProxy.py

+ 1 - 0
Config.ini

@@ -18,6 +18,7 @@ freeProxySixth = 1
 freeProxySeventh = 1
 freeProxyEight = 1
 freeProxyNinth = 1
+freeProxyTen = 1
 ;foreign website, outside the wall
 freeProxyWallFirst = 1
 freeProxyWallSecond = 1

+ 14 - 3
ProxyGetter/getFreeProxy.py

@@ -238,6 +238,17 @@ class GetFreeProxy(object):
                 yield ':'.join(proxy)
 
 
+    @staticmethod
+    def freeProxyTen():
+        urls = ['http://www.ip3366.net/free/']
+        request = WebRequest()
+        for url in urls:
+            r = request.get(url)
+            proxies = re.findall(r'<td>(\d{1,3}\.\d{1,3}\.\d{1,3}\.\d{1,3})</td>[\s\S]*?<td>(\d+)</td>', r.text)
+            for proxy in proxies:
+                yield ":".join(proxy)
+
+
     @staticmethod
     def freeProxyWallFirst():
         """
@@ -356,12 +367,12 @@ if __name__ == '__main__':
 
     # test_batch(gg.freeProxySeventh())
 
-    # to do
-    test_batch(gg.freeProxyEight())
-    # gg.freeProxyEight()
+    # test_batch(gg.freeProxyEight())
 
     # test_batch(gg.freeProxyNinth())
 
+    # test_batch(gg.freeProxyTen())
+
     # test_batch(gg.freeProxyWallFirst())
 
     # test_batch(gg.freeProxyWallSecond())