Skip to content

Commit

Permalink
今日头条文章评论内容抓取
Browse files Browse the repository at this point in the history
  • Loading branch information
haifeng94 authored Dec 28, 2018
1 parent 8746564 commit 930b210
Showing 1 changed file with 3 additions and 5 deletions.
8 changes: 3 additions & 5 deletions get_toutiao_comment.py
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ class Comment(object):
def __init__(self):
self.offset = 0
self.count = 2 #IP失效次数()
self.redis_cli = redis.Redis(host='localhost', port=6379, db=0, password='secret', charset='utf8', decode_responses=True)
self.redis_cli = redis.Redis(host='secret', port=6379, db=0, password='secret', charset='utf8', decode_responses=True)

def get_comment(self, item_id, group_id, save_time):
ua = UserAgent()
Expand Down Expand Up @@ -124,8 +124,8 @@ def parse_comment(self,comments,item_id,group_id,total_number):
try:
url = 'http://secret/spider/toutiao_comment'
requests.post(url, data=items)
jjb_url = 'http://secret/spider/toutiao_comment'
requests.post(jjb_url, data=items)
cm_url = 'http://secret/spider/toutiao_comment'
requests.post(cm_url, data=items)
print('ok!!!!')
except Exception as e:
print('insert db wrong!!!!', e)
Expand Down Expand Up @@ -197,8 +197,6 @@ def parse_reply_comment(self,response,id,reply_list,offset_reply):
except:
reply_to_comment = {}

print('reply_text: ', text)

items = {
'nickname': user_name,
'avatar': avatar_url,
Expand Down

0 comments on commit 930b210

Please sign in to comment.