소스 검색

快手数据抓取优化

zhangyong 1 년 전
부모
커밋
60ae67b813
1개의 변경된 파일5개의 추가작업 그리고 11개의 파일을 삭제
  1. 5 11
      video_capture/kuaishou/kuaishou_author/kuaishou_author.py

+ 5 - 11
video_capture/kuaishou/kuaishou_author/kuaishou_author.py

@@ -109,21 +109,15 @@ class kuaishouAuthor():
                         Feishu.bot('recommend', '快手', '快手cookie失效,请及时更换~')
                         # 如果返回空信息,则随机睡眠 600, 1200 秒
                         time.sleep(random.randint(600, 1200))
-                        continue
+                        return
                     elif "feeds" not in response.json()["data"]["visionProfilePhotoList"]:
                         Common.logger().info(
-                            f"接口请求失败,请更换cookie,{response.status_code}")
-                        Feishu.bot('recommend', '快手', '快手cookie失效,请及时更换~')
-                        # 如果返回空信息,则随机睡眠 600, 1200 秒
-                        time.sleep(random.randint(600, 1200))
-                        continue
+                            f'数据为空{response.json()["data"]["visionProfilePhotoList"]}')
+                        return
                     elif len(response.json()["data"]["visionProfilePhotoList"]["feeds"]) == 0:
                         Common.logger().info(
-                            f"接口请求失败,请更换cookie,{response.status_code}")
-                        Feishu.bot('recommend', '快手', '快手cookie失效,请及时更换~')
-                        # 如果返回空信息,则随机睡眠 600, 1200 秒
-                        time.sleep(random.randint(600, 1200))
-                        continue
+                            f'数据为空{response.json()["data"]["visionProfilePhotoList"]["feeds"]}')
+                        return
                     pcursor = response.json()['data']['visionProfilePhotoList']['pcursor']
                     feeds = response.json()['data']['visionProfilePhotoList']['feeds']
                     count = 0