Explorar el Código

add kuaidaili

bigdata hace 8 años
padre
commit
3f381019fe
Se han modificado 3 ficheros con 19 adiciones y 12 borrados
  1. 3 1
      Config.ini
  2. 0 9
      Dockerfile
  3. 16 2
      ProxyGetter/getFreeProxy.py

+ 3 - 1
Config.ini

@@ -3,6 +3,7 @@
 ;type: SSDB/REDIS/MONGODB if use redis, only modify the host port,the type should be SSDB
 type = SSDB
 host = localhost
+;port = 6379
 port = 8888
 name = proxy
 
@@ -14,8 +15,9 @@ freeProxyThird  = 1
 freeProxyFourth = 1
 freeProxyFifth  = 1
 freeProxySixth = 1
+freeProxySeventh = 1
 
 [HOST]
 ; API接口配置 http://127.0.0.1:5051
 ip = 0.0.0.0
-port = 5010
+port = 5010

+ 0 - 9
Dockerfile

@@ -1,12 +1,8 @@
 FROM python:3.6
-
 WORKDIR /usr/src/app
-
 COPY . .
-
 ENV DEBIAN_FRONTEND noninteractive
 ENV TZ Asia/Shanghai
-
 RUN pip install --no-cache-dir -r requirements.txt && \
 	apt-get update && \
 	apt-get install -y --force-yes git make gcc g++ autoconf && apt-get clean && \
@@ -16,7 +12,6 @@ RUN pip install --no-cache-dir -r requirements.txt && \
 	apt-get autoremove -y && \
 	rm -rf /var/lib/apt/lists/* /tmp/* /var/tmp/* && \
 	cp ssdb.conf /etc && cd .. && yes | rm -r ssdb && \
-
 	mkdir -p /var/lib/ssdb && \
 	sed \
 		-e 's@home.*@home /var/lib@' \
@@ -26,14 +21,10 @@ RUN pip install --no-cache-dir -r requirements.txt && \
 		-e 's@level:.*@level: info@' \
 		-e 's@ip:.*@ip: 0.0.0.0@' \
 		-i /etc/ssdb.conf && \
-
 	echo "# ! /bin/sh " > /usr/src/app/run.sh && \
 	echo "cd Run" >> /usr/src/app/run.sh && \
 	echo "/usr/bin/ssdb-server /etc/ssdb.conf &" >> /usr/src/app/run.sh && \
 	echo "python main.py" >> /usr/src/app/run.sh && \
-
 	chmod 777 run.sh
-
 EXPOSE 5010
-
 CMD [ "sh", "run.sh" ]

+ 16 - 2
ProxyGetter/getFreeProxy.py

@@ -149,6 +149,18 @@ class GetFreeProxy(object):
         except Exception as e:
             pass
 
+    @staticmethod
+    def freeProxySeventh():
+        """
+        快代理免费https://www.kuaidaili.com/free/inha/1/
+        """
+        url = 'https://www.kuaidaili.com/free/inha/{page}/'
+        for page in range(1, 10):
+            page_url = url.format(page=page)
+            tree = getHtmlTree(page_url)
+            proxy_list = tree.xpath('.//table//tr')
+            for tr in proxy_list[1:]:
+                yield ':'.join(tr.xpath('./td/text()')[0:2])
 
 if __name__ == '__main__':
     gg = GetFreeProxy()
@@ -164,8 +176,10 @@ if __name__ == '__main__':
     # for e in gg.freeProxyFourth():
     #     print(e)
 
-    for e in gg.freeProxyFifth():
-        print(e)
+    #for e in gg.freeProxyFifth():
+    #    print(e)
 
     # for e in gg.freeProxySixth():
     #     print(e)
+    for e in gg.freeProxySeventh():
+        print(e)