def main_process(self, topicId):
# print id
reqdata = {'liveId': topicId}
# ?????
reqheaders = {'Content-type': 'application/x-www-form-urlencoded',
'Accept': 'application/json',
'Host': 'h5-zb.leju.com',
'X-Requested-With': 'XMLHttpRequest',
'Origin': 'http://h5-zb.leju.com',
'Referer': 'http://zhichang.renren.com',
'User-Agent': 'Mozilla/5.0 (Windows NT 10.0; WOW64; rv:55.0) Gecko/20100101 Firefox/55.0',}
#'Mozilla/5.0 (Windows NT 10.0; WOW64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/50.0.2661.102 Safari/537.36', }
time.sleep(random.random())
while True:
nowTime = time.ctime()
r = requests.post(self.url, data=reqdata, headers=reqheaders)
msg = '====' + topicId +'===='
tmpDict = r.json()
if ('errorMsg' in tmpDict):
errMsg = tmpDict['errorMsg']
print (nowTime + msg + errMsg)
if ('result' in tmpDict):
print (nowTime + msg + str(tmpDict['result']))
time.sleep(60.33);
评论列表
文章目录