Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

取消失效的ip代理网址,修改评分的注释 #131

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
64 changes: 32 additions & 32 deletions config.py
Original file line number Diff line number Diff line change
Expand Up @@ -24,36 +24,36 @@
'pattern': ".//*[@id='footer']/div/table/tr[position()>1]",
'position': {'ip': './td[1]', 'port': './td[2]', 'type': './td[4]', 'protocol': ''}
},
{
'urls': ['http://cn-proxy.com/', 'http://cn-proxy.com/archives/218'],
'type': 'xpath',
'pattern': ".//table[@class='sortable']/tbody/tr",
'position': {'ip': './td[1]', 'port': './td[2]', 'type': '', 'protocol': ''}

},
# {
# 'urls': ['http://cn-proxy.com/', 'http://cn-proxy.com/archives/218'],
# 'type': 'xpath',
# 'pattern': ".//table[@class='sortable']/tbody/tr",
# 'position': {'ip': './td[1]', 'port': './td[2]', 'type': '', 'protocol': ''}
#
# },
{
'urls': ['http://www.mimiip.com/gngao/%s' % n for n in range(1, 10)],
'type': 'xpath',
'pattern': ".//table[@class='list']/tr",
'position': {'ip': './td[1]', 'port': './td[2]', 'type': '', 'protocol': ''}

},
{
'urls': ['https://proxy-list.org/english/index.php?p=%s' % n for n in range(1, 10)],
'type': 'module',
'moduleName': 'proxy_listPraser',
'pattern': 'Proxy\(.+\)',
'position': {'ip': 0, 'port': -1, 'type': -1, 'protocol': 2}

},
{
'urls': ['http://incloak.com/proxy-list/%s#list' % n for n in
([''] + ['?start=%s' % (64 * m) for m in range(1, 10)])],
'type': 'xpath',
'pattern': ".//table[@class='proxy__t']/tbody/tr",
'position': {'ip': './td[1]', 'port': './td[2]', 'type': '', 'protocol': ''}

},
# {
# 'urls': ['https://proxy-list.org/english/index.php?p=%s' % n for n in range(1, 10)],
# 'type': 'module',
# 'moduleName': 'proxy_listPraser',
# 'pattern': 'Proxy\(.+\)',
# 'position': {'ip': 0, 'port': -1, 'type': -1, 'protocol': 2}
#
# },
# {
# 'urls': ['http://incloak.com/proxy-list/%s#list' % n for n in
# ([''] + ['?start=%s' % (64 * m) for m in range(1, 10)])],
# 'type': 'xpath',
# 'pattern': ".//table[@class='proxy__t']/tbody/tr",
# 'position': {'ip': './td[1]', 'port': './td[2]', 'type': '', 'protocol': ''}
#
# },
{
'urls': ['http://www.kuaidaili.com/proxylist/%s/' % n for n in range(1, 11)],
'type': 'xpath',
Expand Down Expand Up @@ -88,13 +88,13 @@
'pattern': ".//*[@id='ip_list']/tr[position()>1]",
'position': {'ip': './td[2]', 'port': './td[3]', 'type': './td[5]', 'protocol': './td[6]'}
},
{
'urls': ['http://www.cnproxy.com/proxy%s.html' % i for i in range(1, 11)],
'type': 'module',
'moduleName': 'CnproxyPraser',
'pattern': r'<tr><td>(\d+\.\d+\.\d+\.\d+)<SCRIPT type=text/javascript>document.write\(\"\:\"(.+)\)</SCRIPT></td><td>(HTTP|SOCKS4)\s*',
'position': {'ip': 0, 'port': 1, 'type': -1, 'protocol': 2}
}
# {
# 'urls': ['http://www.cnproxy.com/proxy%s.html' % i for i in range(1, 11)],
# 'type': 'module',
# 'moduleName': 'CnproxyPraser',
# 'pattern': r'<tr><td>(\d+\.\d+\.\d+\.\d+)<SCRIPT type=text/javascript>document.write\(\"\:\"(.+)\)</SCRIPT></td><td>(HTTP|SOCKS4)\s*',
# 'position': {'ip': 0, 'port': 1, 'type': -1, 'protocol': 2}
# }
]
'''
数据库的配置
Expand Down Expand Up @@ -183,7 +183,7 @@ def get_header():
'Connection': 'keep-alive',
'Accept-Encoding': 'gzip, deflate',
}
#默认给抓取的ip分配20分,每次连接失败,减一分,直到分数全部扣完从数据库中删除
#默认给抓取的ip分配10分,每次连接失败,减一分,直到分数全部扣完从数据库中删除
DEFAULT_SCORE=10

TEST_URL = 'http://ip.chinaz.com/getip.aspx'
Expand All @@ -205,4 +205,4 @@ def get_header():
MAX_CHECK_CONCURRENT_PER_PROCESS = 30 # CHECK_PROXY时每个进程的最大并发
TASK_QUEUE_SIZE = 50 # 任务队列SIZE
MAX_DOWNLOAD_CONCURRENT = 3 # 从免费代理网站下载时的最大并发
CHECK_WATI_TIME = 1#进程数达到上限时的等待时间
CHECK_WATI_TIME = 1#进程数达到上限时的等待时间