Skip to content

Commit

Permalink
fix a little bug.
Browse files Browse the repository at this point in the history
  • Loading branch information
wuyingren committed May 29, 2017
1 parent ded1d2a commit 4f895e2
Show file tree
Hide file tree
Showing 3 changed files with 20 additions and 28 deletions.
13 changes: 1 addition & 12 deletions license.txt
Original file line number Diff line number Diff line change
Expand Up @@ -176,18 +176,7 @@

END OF TERMS AND CONDITIONS

APPENDIX: How to apply the Apache License to your work.

To apply the Apache License to your work, attach the following
boilerplate notice, with the fields enclosed by brackets "[]"
replaced with your own identifying information. (Don't include
the brackets!) The text should be enclosed in the appropriate
comment syntax for the file format. We also recommend that a
file or class name and description of purpose be included on the
same "printed page" as the copyright notice for easier
identification within third-party archives.

Copyright [yyyy] [name of copyright owner]
Copyright 2017 yingziwu

Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
Expand Down
2 changes: 1 addition & 1 deletion run.py
Original file line number Diff line number Diff line change
Expand Up @@ -145,8 +145,8 @@ def tasker(self):
self.SQ.cursor.execute(sql)
node_ids=self.SQ.cursor.fetchall()
for node_id in node_ids:
node_id=node_id[0]
if queue_name != 'node5' or (queue_name == 'node5' and node_id in self.node_number):
node_id=node_id[0]
if queue_name == 'node5':
self.node_number.remove(int(node_id))
q_node.enqueue(node_spider.start,node_id,sleep_time)
Expand Down
33 changes: 18 additions & 15 deletions settings.py.example
Original file line number Diff line number Diff line change
Expand Up @@ -3,23 +3,26 @@ Created on May 12, 2017

@author: yingziwu
'''
## Settings
# v2ex account
account='v2ex_account'
password='v2ex_password'
# requests headers setting
WEB_headers_list=[{"User-Agent": "Mozilla/5.0 (Windows NT 6.3; rv:36.0) Gecko/20100101 Firefox/36.04", "Referer": "https://v2ex.com/signin"}]
API_headers_list=[{"User-Agent": "Mozilla/5.0 (Linux; Android 6.0; Nexus 5X Build/MDB08L) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/53.0.2785.124 Mobile Safari/537.36"}]
# proxy setting
proxy_enable=True
# Settings
## v2ex account
account='v2ex_account' #v2ex帐号
password='v2ex_password' #v2ex密码
## requests headers setting
### WEB_headers_list:访问v2ex网页版时使用的header池。无需登录页面从列表中随机抽取,需要登录页面使用列表中第一个。
WEB_headers_list=[{"User-Agent": "Mozilla/5.0 (Windows NT 6.3; rv:36.0) Gecko/20100101 Firefox/36.04", "Referer": "https://v2ex.com/signin"},
{"User-Agent": "Mozilla/5.0 (Windows NT 10.0; Win64; x64) Gecko/20100101 Firefox/36.04", "Referer": "https://v2ex.com/signin"}]
### API_headers_list:调用v2ex API时使用的header池。
API_headers_list=[{"User-Agent": "Mozilla/5.0 (Linux; Android 6.0; Nexus 5X Build/MDB08L) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/53.0.2785.124 Mobile Safari/537.36"},
{"User-Agent": "Mozilla/5.0 (Linux; Android 7.0; Nexus 9 Build/NRD90R) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/53.0.2785.124 Safari/537.36"}]
## proxy setting
proxy_enable=False #是否使用代理,默认值为不使用。
### proxies_list:代理池,具体说明详见:http://docs.python-requests.org/en/master/user/advanced/#proxies
proxies_list=[{"http":"socks5://localhost:1080","https":"socks5://localhost:1080"},
{"http":"socks5://localhost:8100","https":"socks5://localhost:8100"},
{"http":"socks5://localhost:8101","https":"socks5://localhost:8101"},
{"http":"socks5://localhost:8101","https":"socks5://localhost:8102"}]
# database setting
database_path="/home/arch/python/v2ex_delete/database.db"
{"http":"http://localhost:8090","https":"http://localhost:8090"},]
## database setting
database_path="/home/arch/python/v2ex_delete/database.db" #sqlite数据库路径

## Program
# Program
import random
proxies=random.choice(proxies_list)
WEB_headers=random.choice(WEB_headers_list)
Expand Down

0 comments on commit 4f895e2

Please sign in to comment.