Sfoglia il codice sorgente

更新下载视频的时长

wangkun 2 anni fa
parent
commit
b09e2f3019
2 ha cambiato i file con 15 aggiunte e 8 eliminazioni
  1. 4 4
      main/demo.py
  2. 11 4
      main/hour_list.py

+ 4 - 4
main/demo.py

@@ -27,10 +27,10 @@ import time
 # print(int("-1"))
 from main.feishu_lib import Feishu
 
-v_upload_time = Feishu.get_range_value("logs", "xiaoniangao", "ba0da4", "J3:J3")[0]
+v_upload_time = Feishu.get_range_value("logs", "xiaoniangao", "ba0da4", "F3:F3")[0]
 print(v_upload_time)
 print(type(v_upload_time))
 
-v_time = int(time.mktime(time.strptime(v_upload_time, "%Y-%m-%d %H:%M:%S")))
-print(v_time)
-print(type(v_time))
+# v_time = int(time.mktime(time.strptime(v_upload_time, "%Y-%m-%d %H:%M:%S")))
+# print(v_time)
+# print(type(v_time))

+ 11 - 4
main/hour_list.py

@@ -780,6 +780,11 @@ class HourList:
                         p_id = Feishu.get_range_value(
                             "logs", "xiaoniangao", "ba0da4", "A" + str(i) + ":" + "A" + str(i))[0]
 
+                        # 视频时长
+                        time.sleep(1)
+                        v_duration = Feishu.get_range_value(
+                            "logs", "xiaoniangao", "ba0da4", "F" + str(i) + ":" + "F" + str(i))[0]
+
                         # profile_mid
                         time.sleep(1)
                         p_mid = Feishu.get_range_value(
@@ -789,6 +794,8 @@ class HourList:
                         # 判断视频 ID 长度,不大于 13 位
                         if len(str(v_id)) > 13:
                             Common.logger().info("视频ID长度大于13位:{}", v_id)
+                        elif int(v_duration) > 600 or int(v_duration) < 60:
+                            Common.logger().info("视频时长不在 1-10分钟 之间")
                         # 过滤带字母的视频ID
                         elif any(word if word in v_id else False for word in cls.sensitive_videoid_words()) is True:
                             Common.logger().info("视频ID带字母:{}".format(v_id))
@@ -913,7 +920,7 @@ class HourList:
                                            hour_video_comment_cnt,
                                            hour_video_like_cnt,
                                            hour_video_share_cnt,
-                                           hour_video_duration,
+                                           int(hour_video_duration)/1000,
                                            hour_video_resolution,
                                            time.strftime("%Y-%m-%d %H:%M:%S",
                                                          time.localtime(int(hour_video_send_time) / 1000)),
@@ -1042,7 +1049,7 @@ class HourList:
                                            hour_video_comment_cnt,
                                            hour_video_like_cnt,
                                            hour_video_share_cnt,
-                                           hour_video_duration,
+                                           int(hour_video_duration)/1000,
                                            hour_video_resolution,
                                            time.strftime("%Y-%m-%d %H:%M:%S",
                                                          time.localtime(int(hour_video_send_time) / 1000)),
@@ -1171,7 +1178,7 @@ class HourList:
                                            hour_video_comment_cnt,
                                            hour_video_like_cnt,
                                            hour_video_share_cnt,
-                                           hour_video_duration,
+                                           int(hour_video_duration)/1000,
                                            hour_video_resolution,
                                            time.strftime("%Y-%m-%d %H:%M:%S",
                                                          time.localtime(int(hour_video_send_time) / 1000)),
@@ -1301,7 +1308,7 @@ class HourList:
                                            hour_video_comment_cnt,
                                            hour_video_like_cnt,
                                            hour_video_share_cnt,
-                                           hour_video_duration,
+                                           int(hour_video_duration)/1000,
                                            hour_video_resolution,
                                            time.strftime("%Y-%m-%d %H:%M:%S",
                                                          time.localtime(int(hour_video_send_time) / 1000)),