Преглед на файлове

抖音数据抓取优化

zhangyong преди 1 година
родител
ревизия
0df4e0b05e
променени са 1 файла, в които са добавени 4 реда и са изтрити 0 реда
  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为空")