|
@@ -72,13 +72,14 @@ class xiaoiceApi():
|
|
|
'''
|
|
|
times = 1
|
|
|
while times:
|
|
|
+ times += 1
|
|
|
response = requests.get("http://weibo.com/aj/message/getbyid?ajwvr=6&uid=5175429989&count=1&_t=0" , headers=self.headers)
|
|
|
self.savePage(response.text, "./tmp/response.txt")
|
|
|
soup = BeautifulSoup(response.json()['data']['html'], "lxml")
|
|
|
text = soup.find("p", class_='page').text
|
|
|
if text != input_strs or times > 20:
|
|
|
break
|
|
|
- time.sleep(0.5)
|
|
|
+ time.sleep(1)
|
|
|
return text
|
|
|
|
|
|
def savePage(self, text, file):
|