wangkun il y a 2 ans
Parent
commit
49a278cb57

+ 7 - 3
common/common.py

@@ -13,6 +13,7 @@ import requests
 import ffmpeg
 import urllib3
 import subprocess
+proxies = {"http": None, "https": None}
 
 
 class Common:
@@ -130,7 +131,8 @@ class Common:
 
             # 下载视频
             urllib3.disable_warnings()
-            response = requests.get(video_url, stream=True, proxies=cls.tunnel_proxies(), verify=False)
+            # response = requests.get(video_url, stream=True, proxies=cls.tunnel_proxies(), verify=False)
+            response = requests.get(video_url, stream=True, proxies=proxies, verify=False)
             try:
                 with open(video_path + video_name, "wb") as f:
                     for chunk in response.iter_content(chunk_size=10240):
@@ -148,7 +150,8 @@ class Common:
 
             # 下载视频
             urllib3.disable_warnings()
-            response = requests.get(audio_url, stream=True, proxies=cls.tunnel_proxies(), verify=False)
+            # response = requests.get(audio_url, stream=True, proxies=cls.tunnel_proxies(), verify=False)
+            response = requests.get(audio_url, stream=True, proxies=proxies, verify=False)
             try:
                 with open(video_path + audio_name, "wb") as f:
                     for chunk in response.iter_content(chunk_size=10240):
@@ -166,7 +169,8 @@ class Common:
 
             # 下载封面
             urllib3.disable_warnings()
-            response = requests.get(cover_url, proxies=cls.tunnel_proxies(), verify=False)
+            # response = requests.get(cover_url, proxies=cls.tunnel_proxies(), verify=False)
+            response = requests.get(cover_url, proxies=proxies, verify=False)
             try:
                 with open(video_path + cover_name, "wb") as f:
                     f.write(response.content)

BIN
xiaoniangao/.DS_Store


BIN
xiaoniangao/videos/.DS_Store


+ 3 - 4
xiaoniangao/xiaoniangao_follow/xiaoniangao_follow.py

@@ -241,7 +241,7 @@ class XiaoniangaoFollow:
 
                         # 发布时间
                         if "t" in feeds[i]:
-                            publish_time_stamp = feeds[i]["t"] / 1000
+                            publish_time_stamp = int(feeds[i]["t"] / 1000)
                         else:
                             publish_time_stamp = 0
                         publish_time_str = time.strftime("%Y-%m-%d %H:%M:%S", time.localtime(publish_time_stamp))
@@ -292,7 +292,7 @@ class XiaoniangaoFollow:
                                 or video_url == 0:
                             Common.logger(log_type, crawler).info("无效视频\n")
                         elif int(time.time()) - publish_time_stamp > 3600*24*3:
-                            Common.logger(log_type, crawler).info(f"发布时间超过3天:{publish_time_str}")
+                            Common.logger(log_type, crawler).info(f"发布时间超过3天:{publish_time_str}\n")
                             cls.next_t = None
                             return
                         else:
@@ -364,7 +364,7 @@ class XiaoniangaoFollow:
                     our_video_link = f"https://testadmin.piaoquantv.com/cms/post-detail/{our_video_id}/info"
                 else:
                     our_video_link = f"https://admin.piaoquantv.com/cms/post-detail/{our_video_id}/info"
-                Common.Common.logger(log_type, crawler).info("视频上传完成")
+                Common.logger(log_type, crawler).info("视频上传完成")
 
                 if our_video_id is None:
                     # 删除视频文件夹
@@ -437,7 +437,6 @@ class XiaoniangaoFollow:
 
         except Exception as e:
             Common.logger(log_type, crawler).error("下载/上传异常:{}", e)
-            Feishu.dimension_range("person", "xiaoniangao", "k6ldje", "ROWS", 2, 2)
 
     # 获取所有关注列表的用户视频
     @classmethod