Explorar o código

祝福咱们中老年之视频 修改video_url

zhangyong hai 1 ano
pai
achega
0ae5c652c6

+ 5 - 1
zhufuzanmenzhonglaonianzhishipin/zhufuzanmenzhonglaonianzhishipin_recommend/zhufuzanmenzhonglaonianzhishipin_recommend.py

@@ -10,6 +10,7 @@ import requests
 from hashlib import md5
 from hashlib import md5
 from datetime import datetime
 from datetime import datetime
 
 
+from common import get_redirect_url
 from common.mq import MQ
 from common.mq import MQ
 
 
 sys.path.append(os.getcwd())
 sys.path.append(os.getcwd())
@@ -176,6 +177,9 @@ class Zfzmmzlnzspcheduling:
             Common.logger(self.log_type, self.crawler).info("视频已下载\n")
             Common.logger(self.log_type, self.crawler).info("视频已下载\n")
             Common.logging(self.log_type, self.crawler, self.env, "视频已下载\n")
             Common.logging(self.log_type, self.crawler, self.env, "视频已下载\n")
         else:
         else:
+            video_url = video_obj['video_url']
+            video_url = get_redirect_url(video_url)
+
             video_dict["out_user_id"] = video_dict["profile_id"]
             video_dict["out_user_id"] = video_dict["profile_id"]
             video_dict["platform"] = self.crawler
             video_dict["platform"] = self.crawler
             video_dict["strategy"] = self.log_type
             video_dict["strategy"] = self.log_type
@@ -185,7 +189,7 @@ class Zfzmmzlnzspcheduling:
             video_dict["crawler_rule"] = json.dumps(self.rule_dict)
             video_dict["crawler_rule"] = json.dumps(self.rule_dict)
             video_dict["user_id"] = self.our_uid
             video_dict["user_id"] = self.our_uid
             video_dict["publish_time"] = video_dict["publish_time_str"]
             video_dict["publish_time"] = video_dict["publish_time_str"]
-            video_dict["video_url"] = video_obj['video_url']
+            video_dict["video_url"] = video_url
             video_dict["avatar_url"] = video_obj['end_cover']
             video_dict["avatar_url"] = video_obj['end_cover']
             video_dict["cover_url"] = video_obj['images']
             video_dict["cover_url"] = video_obj['images']
             self.download_count += 1
             self.download_count += 1