Selaa lähdekoodia

抖音数据抓取优化

zhangyong 1 vuosi sitten
vanhempi
commit
0df4e0b05e
1 muutettua tiedostoa jossa 4 lisäystä ja 0 poistoa
  1. 4 0
      video_capture/douyin/douyin_author/douyin_author.py

+ 4 - 0
video_capture/douyin/douyin_author/douyin_author.py

@@ -103,6 +103,10 @@ class douyinAuthor():
                 s.mount('http://', HTTPAdapter(max_retries=3))
                 s.mount('https://', HTTPAdapter(max_retries=3))
                 response = requests.request(method='GET', url=url, headers=headers, params=query)
+                text = response.text
+                if len(text) == 0:
+                    time.sleep(60)
+                    continue
                 body = response.content.decode()
                 if body == "":
                     Common.logger().info(f"请求获取body为空")