Skip to content

Commit

Permalink
a little change.
Browse files Browse the repository at this point in the history
  • Loading branch information
wuyingren committed May 20, 2017
1 parent 9fd013e commit 9151e3c
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 3 deletions.
2 changes: 1 addition & 1 deletion run.py
Original file line number Diff line number Diff line change
Expand Up @@ -145,7 +145,7 @@ def load_config(self):

def tester_tasker(self):
if int(time.time())-int(self.time_log["tester"]) >= 1800:
sql="SELECT ID FROM TOPIC WHERE (time - created) < 86400 AND ID NOT IN (SELECT T_ID FROM STATUS) AND (STRFTIME('%s','now') - time) > 1209600;"
sql="SELECT ID FROM TOPIC WHERE (time - created) < 172800 AND ID NOT IN (SELECT T_ID FROM STATUS) AND (STRFTIME('%s','now') - time) > 1209600;"
sleep_time=20
self.SQ.cursor.execute(sql)
topic_ids=[x[0] for x in self.SQ.cursor.fetchall()]
Expand Down
2 changes: 2 additions & 0 deletions v2ex_spider/rss_spider.py
Original file line number Diff line number Diff line change
Expand Up @@ -117,8 +117,10 @@ def gen_topic_queue(self):
t_queue.enqueue(topic_spider.start,topic_id, self.topic_sleep_time)
#save topics
topics_all=list()
topics_all.extend(tmp_topics)
topics_all.extend(topics_rss)
topics_all.extend(topics_sql)
topics_all=list(set(topics_all))
with open('.topics_all.json','w') as f:
json.dump(topics_all, f)
return
Expand Down
6 changes: 4 additions & 2 deletions v2ex_tester/topic_tester.py
Original file line number Diff line number Diff line change
Expand Up @@ -13,13 +13,14 @@

class tester(object):
'''
classdocs
The tester for v2ex topics.
'''


def __init__(self):
'''
Constructor
>>>from v2ex_tester import topic_tester
>>>topic_tester(topic_id,sleep_time)
'''
self.s=requests.session()
self.s.proxies=settings.proxies
Expand All @@ -33,6 +34,7 @@ def log_in(self):
cookies=requests.utils.cookiejar_from_dict(json.load(f))
self.s.cookies=cookies
self.s.headers=settings.WEB_headers_list[0]
self.log_status=True
return

def web_test(self,t_id,status):
Expand Down

0 comments on commit 9151e3c

Please sign in to comment.