# haipproxy **Repository Path**: tomlin_private/haipproxy ## Basic Information - **Project Name**: haipproxy - **Description**: HAipproxy是一款代理IP程序,包含代理抓取、校验和调度三个核心组件。主要特点是高可用、低时延 - **Primary Language**: Python - **License**: MIT - **Default Branch**: master - **Homepage**: https://github.com/ResolveWang/haipproxy - **GVP Project**: No ## Statistics - **Stars**: 0 - **Forks**: 3 - **Created**: 2018-04-25 - **Last Updated**: 2020-12-19 ## Categories & Tags **Categories**: Uncategorized **Tags**: None ## README # HAipproxy [中文文档](README.md) | [README](README_EN.md) This project crawls proxy ip resources from the Internet.What we wish is to provide a anonymous ip proxy pool with **highly availability and low latency** for distributed spiders. # Features - Distributed crawlers with high performance, powered by scrapy and redis - Large-scale of proxy ip resources - HA design for both crawlers and schedulers - Flexible architecture with task routing - Support HTTP/HTTPS and Socks5 proxy - MIT LICENSE.Feel free to do whatever you want # Quick start ### Standalone #### Server - Install Python3 and Redis Server - Change redis args of the project *[config/settings.py](config/settings.py)* according to redis conf,such as `REDIS_HOST`,`REDIS_PASSWORD` - Install [scrapy-splash](https://github.com/scrapy-plugins/scrapy-splash) and change `SPLASH_URL` in *[config/settings.py](config/settings.py)* - Install dependencies > pip install -r requirements.txt - Start *scrapy worker*,including ip proxy crawler and validator > python crawler_booter.py --usage crawler > python crawler_booter.py --usage validator - Start *task scheduler*,including crawler task scheduler and validator task scheduler > python scheduler_booter.py --usage crawler > python scheduler_booter.py --usage validator #### Client(Here we use squid) - Install squid,copy it's conf as a backup and then start squid, take *ubuntu* for example > sudo apt-get install squid > sudo sed -i 's/http_access deny all/http_access allow all/g' > sudo cp /etc/squid/squid.conf /etc/squid/squid.conf.backup > sudo service squid start - Change `SQUID_BIN_PATH`,`SQUID_CONF_PATH` and `SQUID_TEMPLATE_PATH` in *[config/settings.py](config/settings.py)* according to your OS - Update squid conf periodically > sudo python squid_update.py - After a while,you can send requests with squid proxies, the proxies url is 'http://squid_host:3128', e.g. ```python3 import requests proxies = {'https': 'http://127.0.0.1:3128'} resp = requests.get('https://httpbin.org/ip', proxies=proxies) print(resp.text) ``` ### Dockerize - Install Docker - Install docker-compose > pip install -U docker-compose - Change`SPLASH_URL`and`REDIS_HOST`in [settings.py](config/settings.py) - Start all the containers using docker-compose > docker-compose up - Send requests with squid proxies ```python3 import requests proxies = {'https': 'http://127.0.0.1:3128'} resp = requests.get('https://httpbin.org/ip', proxies=proxies) print(resp.text) ``` # WorkFlow ![](static/workflow.png) # Other important things - This project is highly dependent on redis,if you want to replace redis with another mq or database, just do it at your own risk - If there is no Great Fire Wall at your country,set`proxy_mode=0` in both [gfw_spider.py](crawler/spiders/ajax_spider.py) and [ajax_gfw_spider.py](crawler/spiders/ajax_gfw_spider.py). If you don't want to crawl some websites, set `enable=0` in [rules.py](config/rules.py) - Issues and PRs are welcome - Just star it if it's useful to you # Reference Thanks to all the contributors of the following projects. [dungproxy](https://github.com/virjar/dungproxy) [proxyspider](https://github.com/zhangchenchen/proxyspider) [ProxyPool](https://github.com/henson/ProxyPool) [proxy_pool](https://github.com/jhao104/proxy_pool) [ProxyPool](https://github.com/WiseDoge/ProxyPool) [IPProxyTool](https://github.com/awolfly9/IPProxyTool) [IPProxyPool](https://github.com/qiyeboy/IPProxyPool) [proxy_list](https://github.com/gavin66/proxy_list) [proxy_pool](https://github.com/lujqme/proxy_pool)