Browse Source

update 快手视频链接获取方式修改

lierqiang 2 years ago
parent
commit
613bcab68c
1 changed files with 6 additions and 6 deletions
  1. 6 6
      kuaishou/kuaishou_follow/kuaishou_follow.py

+ 6 - 6
kuaishou/kuaishou_follow/kuaishou_follow.py

@@ -488,7 +488,7 @@ class Follow:
 
                         # video_width / video_height / video_url
                         mapping = {}
-                        for item in ['width', 'height', 'url']:
+                        for item in ['width', 'height']:
                             try:
                                 val = str(videoResource['h264']['adaptationSet'][0]['representation'][0][item])
                             except Exception:
@@ -498,8 +498,6 @@ class Follow:
                             mapping[item] = val
                         video_width = int(mapping['width']) if mapping['width'] != '' else 0
                         video_height = int(mapping['height']) if mapping['height'] != '' else 0
-                        video_url = mapping['url']
-
                         # cover_url
                         if 'coverUrl' not in feeds[i]['photo']:
                             cover_url = ""
@@ -514,6 +512,7 @@ class Follow:
                             user_name = ''
                             avatar_url = ''
 
+                        video_url = feeds[i]['photoUrl']
                         video_dict = {'video_title': video_title,
                                       'video_id': video_id,
                                       'play_cnt': play_cnt,
@@ -767,10 +766,11 @@ if __name__ == "__main__":
                          crawler="kuaishou",
                          strategy="定向爬虫策略",
                          our_uid="6282431",
-                         out_uid="3xws7ydsnmp5mgq",
+                         out_uid="3x3wsqjsxu5j6de",
                          oss_endpoint="out",
                          env="dev",
                          machine="local")
-    print(Follow.get_out_user_info("follow", "kuaishou", "3xgh4ja9be3wcaw"))
-    print(Follow.get_out_user_info("follow", "kuaishou", "3x5wgjhfc7tx8ue"))
+
+    # print(Follow.get_out_user_info("follow", "kuaishou", "3xgh4ja9be3wcaw"))
+    # print(Follow.get_out_user_info("follow", "kuaishou", "3x5wgjhfc7tx8ue"))