| 
					
				 | 
			
			
				@@ -8,6 +8,7 @@ import urllib3 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				  
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 from main.common import Common 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 from main.feishu_lib import Feishu 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+from main.publish import Publish 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				  
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 proxies = {"http": None, "https": None} 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				  
			 | 
		
	
	
		
			
				| 
					
				 | 
			
			
				@@ -19,6 +20,7 @@ class HourList: 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				         # 敏感词库列表 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				         word_list = [] 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				         # 从云文档读取所有敏感词,添加到词库列表 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        time.sleep(1) 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				         lists = Feishu.get_values_batch("person-logs", "xiaoniangao", "DRAnZh") 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				         for i in lists: 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				             for j in i: 
			 | 
		
	
	
		
			
				| 
					
				 | 
			
			
				@@ -29,6 +31,16 @@ class HourList: 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                     word_list.append(j) 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				         return word_list 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				  
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+    # 视频ID过滤字母 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+    @classmethod 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+    def sensitive_videoid_words(cls): 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        # 字母列表 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        words_list = ["a", "b", "c", "d", "e", "f", "g", "h", "i", "j", "k", "l", "m", "n", "o", "p", "q", "r", "s", 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                      "t", "u", "v", "w", "x", "y", "z", 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                      "A", "B", "C", "D", "E", "F", "G", "H", "I", "J", "K", "L", "M", "N", "O", "P", "Q", "R", "S", 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                      "T", "U", "V", "W", "X", "Y", "Z"] 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        return words_list 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				     # 下载规则 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				     @staticmethod 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				     def download_rule(d_duration, d_width, d_height, d_play_cnt, d_like_cnt, d_share_cnt): 
			 | 
		
	
	
		
			
				| 
					
				 | 
			
			
				@@ -57,6 +69,45 @@ class HourList: 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				             return False 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				         return False 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				  
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+    # 检查是否有今日的上升榜日期 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+    @classmethod 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+    def check_hour_list_data(cls, date): 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        # 判断J1单元格的日期是否为今天 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        time.sleep(1) 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        if Feishu.get_range_value("logs", "xiaoniangao", "ba0da4", "L1:N1")[0] != date: 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+            # 插入3列 L1:N1,并写入日期和时间数据 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+            values = [[date], ["10:00", "15:00", "20:00"]] 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+            time.sleep(1) 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+            Feishu.insert_columns("logs", "xiaoniangao", "ba0da4", "COLUMNS", 11, 14) 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+            time.sleep(1) 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+            Feishu.update_values("logs", "xiaoniangao", "ba0da4",  "L1:N2", values) 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+            time.sleep(1) 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+            Feishu.merge_cells("logs", "xiaoniangao", "ba0da4", "L1:N1") 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+            Common.logger().info("插入今天日期成功") 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        else: 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+            Common.logger().info("今日上升榜日期已存在") 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+    # 清除空行 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+    @classmethod 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+    def del_null_rows(cls, crawler, sheetid, startindex): 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        """ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        :params sheetid:工作表 ID 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        :params startindex:从第几行开始清除 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        """ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        time.sleep(1) 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        for i in range(int(startindex), len(Feishu.get_values_batch("logs", crawler, sheetid)) + 1): 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+            time.sleep(1) 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+            Common.logger().info("正在检查第:{}行", i) 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+            # 删除空行 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+            if Feishu.get_range_value("logs", crawler, sheetid, "A" + str(i) + ":" + "A" + str(i))[0] is None\ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                    and Feishu.get_range_value("logs", crawler, sheetid, "B" + str(i) + ":" + "B" + str(i))[0] is None\ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                    and Feishu.get_range_value("logs", crawler, sheetid, "C" + str(i) + ":" + "C" + str(i))[0] is None\ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                    and Feishu.get_range_value("logs", crawler, sheetid, "D" + str(i) + ":" + "D" + str(i))[0] is None: 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                Common.logger().info("当前第{}行为空行,删除", i) 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                time.sleep(1) 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                Feishu.dimension_range("logs", crawler, sheetid, "ROWS", i, i) 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        Common.logger().info("删除空行完成") 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				     # 获取列表 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				     @classmethod 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				     def get_hour_list_feeds(cls): 
			 | 
		
	
	
		
			
				| 
					
				 | 
			
			
				@@ -264,20 +315,35 @@ class HourList: 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                         Common.logger().warning("无效视频") 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				  
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                     # 判断发布时间是否 > 7天 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-                    elif int(time.time()) - int(video_send_time)/1000 > 604800: 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                    elif int(time.time()) - int(video_send_time) / 1000 > 604800: 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                         Common.logger().info("发布时间大于7天", video_title) 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				  
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                     # 判断播放量是否 > 5000 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                     elif int(video_play_cnt) < 5000: 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                         Common.logger().info("该视频7天内播放量<5000:{}", video_title) 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				  
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                    # 判断视频 ID 长度,不大于 13 位 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                    elif len(str(video_id)) > 13: 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                        Common.logger().info("视频ID长度大于13位:{}", video_id) 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                    # 过滤带字母的视频ID 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                    elif any(word if word in video_id else False for word in cls.sensitive_videoid_words()) is True: 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                        Common.logger().info("视频ID带字母:{}".format(video_id)) 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                     # 过滤敏感词 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                     elif any(word if word in video_title else False for word in cls.sensitive_words()) is True: 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-                        Common.logger().info("视频已中敏感词:{}".format(video_title)) 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                        Common.logger().info("视频已中敏感词:{}".format(video_title)) 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                        time.sleep(1) 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                    # 从云文档中去重:https://w42nne6hzg.feishu.cn/sheets/shtcnYxiyQ1wLklo1W5Kdqc9cGh?sheet=yatRv2 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                    elif video_id in [j for i in Feishu.get_values_batch("logs", "xiaoniangao", "yatRv2") for j in i]: 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                        Common.logger().info("该视频已下载:{}", video_title) 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                        time.sleep(1) 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				  
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-                    # 从云文档去重:https://w42nne6hzg.feishu.cn/sheets/shtcngRPoDYAi24x52j2nDuHMih?sheet=onyBDH 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                    # 从云文档去重:https://w42nne6hzg.feishu.cn/sheets/shtcnYxiyQ1wLklo1W5Kdqc9cGh?sheet=ba0da4 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                     elif video_id in [j for i in Feishu.get_values_batch("logs", "xiaoniangao", "ba0da4") for j in i]: 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-                        Common.logger().info("该视频已保存过:{}", video_title) 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                        Common.logger().info("该视频已保存过:{}", video_title) 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                        time.sleep(1) 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                     else: 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                         Common.logger().info("该视频未下载,添加至feeds中:{}".format(video_title)) 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                         # feeds工作表,插入空行 
			 | 
		
	
	
		
			
				| 
					
				 | 
			
			
				@@ -305,42 +371,6 @@ class HourList: 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				         except Exception as e: 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				             Common.logger().error("获取小时榜视频列表异常:{}", e) 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				  
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-    # 检查是否有今日的上升榜日期 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-    @classmethod 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-    def check_hour_list_data(cls, date): 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-        # 判断J1单元格的日期是否为今天 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-        if Feishu.get_range_value("logs", "xiaoniangao", "ba0da4", "L1:N1")[0] != date: 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-            # 插入3列 L1:N1,并写入日期和时间数据 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-            values = [[date], ["10:00", "15:00", "20:00"]] 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-            time.sleep(1) 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-            Feishu.insert_columns("logs", "xiaoniangao", "ba0da4", "COLUMNS", 11, 14) 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-            time.sleep(1) 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-            Feishu.update_values("logs", "xiaoniangao", "ba0da4",  "L1:N2", values) 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-            time.sleep(1) 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-            Feishu.merge_cells("logs", "xiaoniangao", "ba0da4", "L1:N1") 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-            Common.logger().info("插入今天日期成功") 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-        else: 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-            Common.logger().info("今日上升榜日期已存在") 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				- 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-    # 清除空行 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-    @classmethod 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-    def del_null_rows(cls, crawler, sheetid, startindex): 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-        """ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-        :params sheetid:工作表 ID 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-        :params startindex:从第几行开始清除 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-        """ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-        for i in range(int(startindex), len(Feishu.get_values_batch("logs", crawler, sheetid)) + 1): 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-            time.sleep(1) 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-            Common.logger().info("正在检查第:{}行", i) 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-            # 删除空行 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-            if Feishu.get_range_value("logs", crawler, sheetid, "A" + str(i) + ":" + "A" + str(i))[0] is None\ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-                    and Feishu.get_range_value("logs", crawler, sheetid, "B" + str(i) + ":" + "B" + str(i))[0] is None\ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-                    and Feishu.get_range_value("logs", crawler, sheetid, "C" + str(i) + ":" + "C" + str(i))[0] is None\ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-                    and Feishu.get_range_value("logs", crawler, sheetid, "D" + str(i) + ":" + "D" + str(i))[0] is None: 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-                Common.logger().info("当前第{}行为空行,删除", i) 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-                Feishu.dimension_range("logs", crawler, sheetid, "ROWS", i, i) 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-        Common.logger().info("删除空行完成") 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				- 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				     # 更新小时榜数据 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				     @classmethod 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				     def update_hour_list_data(cls, today, yesterday, before_yesterday): 
			 | 
		
	
	
		
			
				| 
					
				 | 
			
			
				@@ -348,9 +378,11 @@ class HourList: 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				         更新小时榜数据 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				         """ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				         try: 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+            time.sleep(1) 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				             if len(Feishu.get_values_batch("logs", "xiaoniangao", "ba0da4")) == 2: 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                 Common.logger().info("当前工作表无数据") 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				             else: 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                time.sleep(1) 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                 for i in range(3, len(Feishu.get_values_batch("logs", "xiaoniangao", "ba0da4"))+1): 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                     time.sleep(1) 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                     Common.logger().info("更新第:{}行视频信息", i) 
			 | 
		
	
	
		
			
				| 
					
				 | 
			
			
				@@ -365,31 +397,37 @@ class HourList: 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                         Common.logger().info("空行,略过") 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                     else: 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                         # 视频标题 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                        time.sleep(1) 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                         v_title = Feishu.get_range_value( 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                             "logs", "xiaoniangao", "ba0da4", "D" + str(i) + ":" + "D" + str(i))[0] 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                         Common.logger().info("视频详情,video_title:{},{}", v_title, type(v_title)) 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				  
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                         # 视频 ID 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                        time.sleep(1) 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                         v_id = Feishu.get_range_value( 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                             "logs", "xiaoniangao", "ba0da4", "C" + str(i) + ":" + "C" + str(i))[0] 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                         Common.logger().info("视频详情,video_id:{},{}", v_id, type(v_id)) 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				  
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                         # profile_id,用户 ID 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                        time.sleep(1) 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                         p_id = Feishu.get_range_value( 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                             "logs", "xiaoniangao", "ba0da4", "A" + str(i) + ":" + "A" + str(i))[0] 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                         Common.logger().info("视频详情,profile_id:{},{}", p_id, type(p_id)) 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				  
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                         # profile_mid 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                        time.sleep(1) 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                         p_mid = Feishu.get_range_value( 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                             "logs", "xiaoniangao", "ba0da4", "B" + str(i) + ":" + "B" + str(i))[0] 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                         Common.logger().info("视频详情,profile_mid:{},{}", p_mid, type(p_mid)) 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				  
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                         # 抓取时的播放量 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                        time.sleep(1) 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                         v_play_cnt = Feishu.get_range_value( 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                             "logs", "xiaoniangao", "ba0da4", "K" + str(i) + ":" + "K" + str(i))[0] 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                         Common.logger().info("视频详情,video_play_cnt:{},{}", v_play_cnt, type(v_play_cnt)) 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				  
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                         # 抓取时间 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                        time.sleep(1) 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                         v_upload_time = Feishu.get_range_value( 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                             "logs", "xiaoniangao", "ba0da4", "J" + str(i) + ":" + "J" + str(i))[0] 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                         Common.logger().info("视频详情,video_send_time:{},{}", v_upload_time, type(v_upload_time)) 
			 | 
		
	
	
		
			
				| 
					
				 | 
			
			
				@@ -479,6 +517,7 @@ class HourList: 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                                 Common.logger().info("当天 15:00 视频播放量:{}", fifteen_hour_play_cnt) 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				  
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                                 # 当天 10:00 上升的数据 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                                time.sleep(1) 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                                 if Feishu.get_range_value( 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                                         "logs", "xiaoniangao", "ba0da4", "L"+str(i) + ":" + "L"+str(i))[0] is None: 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                                     ten_up_cnt = 0 
			 | 
		
	
	
		
			
				| 
					
				 | 
			
			
				@@ -515,6 +554,7 @@ class HourList: 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                                 Common.logger().info("当天 20:00 视频播放量:{}", twenty_hour_play_cnt) 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				  
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                                 # 当天 10:00 上升的数据 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                                time.sleep(1) 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                                 if Feishu.get_range_value( 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                                         "logs", "xiaoniangao", "ba0da4", "L" + str(i) + ":" + "L" + str(i))[0] is None: 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                                     ten_up_cnt = 0 
			 | 
		
	
	
		
			
				| 
					
				 | 
			
			
				@@ -523,6 +563,7 @@ class HourList: 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                                         "logs", "xiaoniangao", "ba0da4", "L" + str(i) + ":" + "L" + str(i))[0] 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				  
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                                 # 当天 15:00 上升的数据 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                                time.sleep(1) 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                                 if Feishu.get_range_value( 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                                         "logs", "xiaoniangao", "ba0da4", "M" + str(i) + ":" + "M" + str(i))[0] is None: 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                                     fifteen_up_cnt = 0 
			 | 
		
	
	
		
			
				| 
					
				 | 
			
			
				@@ -546,6 +587,7 @@ class HourList: 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                                 Common.logger().info("当天 20:00 视频播放量:{}", twenty_hour_play_cnt) 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				  
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                                 # 当天 15:00 上升的数据 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                                time.sleep(1) 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                                 if Feishu.get_range_value( 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                                         "logs", "xiaoniangao", "ba0da4", "M" + str(i) + ":" + "M" + str(i))[0] is None: 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                                     fifteen_up_cnt = 0 
			 | 
		
	
	
		
			
				| 
					
				 | 
			
			
				@@ -598,6 +640,7 @@ class HourList: 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                                 Common.logger().info("当天 15:00 视频播放量:{}", fifteen_hour_play_cnt) 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				  
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                                 # 当天 10:00 上升的数据 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                                time.sleep(1) 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                                 if Feishu.get_range_value( 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                                         "logs", "xiaoniangao", "ba0da4", "L" + str(i) + ":" + "L" + str(i))[0] is None: 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                                     ten_up_cnt = 0 
			 | 
		
	
	
		
			
				| 
					
				 | 
			
			
				@@ -621,6 +664,7 @@ class HourList: 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                                 Common.logger().info("当天 20:00 视频播放量:{}", twenty_hour_play_cnt) 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				  
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                                 # 当天 10:00 上升的数据 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                                time.sleep(1) 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                                 if Feishu.get_range_value( 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                                         "logs", "xiaoniangao", "ba0da4", "L" + str(i) + ":" + "L" + str(i))[0] is None: 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                                     ten_up_cnt = 0 
			 | 
		
	
	
		
			
				| 
					
				 | 
			
			
				@@ -629,6 +673,7 @@ class HourList: 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                                         "logs", "xiaoniangao", "ba0da4", "L" + str(i) + ":" + "L" + str(i))[0] 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				  
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                                 # 当天 15:00 上升的数据 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                                time.sleep(1) 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                                 if Feishu.get_range_value( 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                                         "logs", "xiaoniangao", "ba0da4", "M" + str(i) + ":" + "M" + str(i))[0] is None: 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                                     fifteen_up_cnt = 0 
			 | 
		
	
	
		
			
				| 
					
				 | 
			
			
				@@ -649,9 +694,630 @@ class HourList: 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				         except Exception as e: 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				             Common.logger().error("获取小时榜数据异常:{}", e) 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				  
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+    # 下载/上传 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+    @classmethod 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+    def download_and_publish(cls): 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        """ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        1.从云文档中去重: https://w42nne6hzg.feishu.cn/sheets/shtcnYxiyQ1wLklo1W5Kdqc9cGh?sheet=yatRv2 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        2.从云文档中下载符合规则的视频:https://w42nne6hzg.feishu.cn/sheets/shtcnYxiyQ1wLklo1W5Kdqc9cGh?sheet=ba0da4 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+            2.1 当日 10:00 or 15:00 or 20:00 视频播放量上升 > 5000 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+            2.2 当日 10:00 and 15:00 视频播放量上升 > 2000 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+            2.3 当日 15:00 and 20:00 视频播放量上升 > 2000 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+            2.4 昨日 20:00 and 今日 10:00 视频播放量上升 > 2000 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        3.上传 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        """ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        try: 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+            time.sleep(1) 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+            if len(Feishu.get_values_batch("logs", "xiaoniangao", "ba0da4")) == 2: 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                Common.logger().info("当前工作表无数据") 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+            else: 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                time.sleep(1) 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                for i in range(3, len(Feishu.get_values_batch("logs", "xiaoniangao", "ba0da4"))+1): 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                    time.sleep(1) 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                    Common.logger().info("分析第:{}行视频信息是否符合下载规则", i) 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                    # 略过空行 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                    if Feishu.get_range_value( 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                            "logs", "xiaoniangao", "ba0da4", "D" + str(i) + ":" + "D" + str(i))[0] is None\ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                            and Feishu.get_range_value( 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                            "logs", "xiaoniangao", "ba0da4", "C"+str(i)+":"+"C"+str(i))[0] is None\ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                            and Feishu.get_range_value( 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                            "logs", "xiaoniangao", "ba0da4", "A"+str(i)+":"+"A"+str(i))[0] is None: 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                        Common.logger().info("空行,略过") 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                    else: 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                        # 今日 10:00 数据上升量 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                        time.sleep(1) 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                        if Feishu.get_range_value( 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                                "logs", "xiaoniangao", "ba0da4", "L" + str(i) + ":" + "L" + str(i))[0] is None: 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                            ten_cnt = 0 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                        else: 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                            ten_cnt = Feishu.get_range_value( 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                                "logs", "xiaoniangao", "ba0da4", "L" + str(i) + ":" + "L" + str(i))[0] 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                        # 今日 15:00 数据上升量 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                        time.sleep(1) 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                        if Feishu.get_range_value( 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                                "logs", "xiaoniangao", "ba0da4", "M" + str(i) + ":" + "M" + str(i))[0] is None: 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                            fifteen_cnt = 0 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                        else: 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                            fifteen_cnt = Feishu.get_range_value( 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                                "logs", "xiaoniangao", "ba0da4", "M" + str(i) + ":" + "M" + str(i))[0] 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                        # 今日 20:00 数据上升量 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                        time.sleep(1) 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                        if Feishu.get_range_value( 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                                "logs", "xiaoniangao", "ba0da4", "N" + str(i) + ":" + "N" + str(i))[0] is None: 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                            twenty_cnt = 0 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                        else: 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                            twenty_cnt = Feishu.get_range_value( 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                                "logs", "xiaoniangao", "ba0da4", "N" + str(i) + ":" + "N" + str(i))[0] 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                        # 昨日 20:00 数据上升量 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                        time.sleep(1) 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                        if Feishu.get_range_value( 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                                "logs", "xiaoniangao", "ba0da4", "Q" + str(i) + ":" + "Q" + str(i))[0] is None: 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                            yesterday_twenty_cnt = 0 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                        else: 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                            yesterday_twenty_cnt = Feishu.get_range_value( 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                                "logs", "xiaoniangao", "ba0da4", "Q" + str(i) + ":" + "Q" + str(i))[0] 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                        # 视频标题 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                        time.sleep(1) 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                        v_title = Feishu.get_range_value( 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                            "logs", "xiaoniangao", "ba0da4", "D" + str(i) + ":" + "D" + str(i))[0] 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                        Common.logger().info("视频详情,video_title:{},{}", v_title, type(v_title)) 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                        # 视频 ID 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                        time.sleep(1) 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                        v_id = Feishu.get_range_value( 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                            "logs", "xiaoniangao", "ba0da4", "C" + str(i) + ":" + "C" + str(i))[0] 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                        Common.logger().info("视频详情,video_id:{},{}", v_id, type(v_id)) 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                        # profile_id,用户 ID 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                        time.sleep(1) 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                        p_id = Feishu.get_range_value( 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                            "logs", "xiaoniangao", "ba0da4", "A" + str(i) + ":" + "A" + str(i))[0] 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                        # profile_mid 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                        time.sleep(1) 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                        p_mid = Feishu.get_range_value( 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                            "logs", "xiaoniangao", "ba0da4", "B" + str(i) + ":" + "B" + str(i))[0] 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                        Common.logger().info("10:00 / 15:00 / 20:00 上升量: {} / {} / {}", 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                                             ten_cnt, fifteen_cnt, twenty_cnt) 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                        # 判断视频 ID 长度,不大于 13 位 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                        if len(str(v_id)) > 13: 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                            Common.logger().info("视频ID长度大于13位:{}", v_id) 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                        # 过滤带字母的视频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)) 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                        # 上升榜判断逻辑,任意时间段上升量>=5000,连续两个时间段上升量>=2000 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                        elif int(ten_cnt) >= 5000 or int(fifteen_cnt) >= 5000 or int(twenty_cnt) >= 5000: 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                            Common.logger().info("10:00 or 15:00 or 20:00 数据上升量:{} or {} or {} >= 5000", 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                                                 ten_cnt, fifteen_cnt, twenty_cnt) 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                            Common.logger().info("满足下载规则,开始下载视频") 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                            try: 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                                url = "https://kapi.xiaoniangao.cn/profile/get_profile_by_id" 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                                headers = { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                                    "x-b3-traceid": "bd267349bf41b", 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                                    "X-Token-Id": "86f6d7cc2b2b6870004df5d16c82aaf3-1185665701", 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                                    "uid": "8fde3c6c-c070-4379-bfc4-15c7e85139c9", 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                                    "content-type": "application/json", 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                                    "Accept-Encoding": "gzip,compress,br,deflate", 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                                    "User-Agent": 'Mozilla/5.0 (iPhone; CPU iPhone OS 14_7_1 like Mac OS X)' 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                                                  ' AppleWebKit/605.1.15 (KHTML, like Gecko) Mobile/15E148 ' 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                                                  'MicroMessenger/8.0.20(0x18001432) NetType/WIFI Language/zh_CN', 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                                    "Referer": "https://servicewechat.com/wxd7911e4c177690e4/617/page-frame.html" 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                                } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                                data = { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                                    "play_src": "1", 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                                    "profile_id": int(p_id), 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                                    "profile_mid": int(p_mid), 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                                    "qs": "imageMogr2/gravity/center/rotate/$/thumbnail/" 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                                          "!400x400r/crop/400x400/interlace/1/format/jpg", 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                                    "h_qs": "imageMogr2/gravity/center/rotate/$/thumbnail" 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                                            "/!80x80r/crop/80x80/interlace/1/format/jpg", 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                                    "share_width": 625, 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                                    "share_height": 500, 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                                    "no_comments": True, 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                                    "no_follow": True, 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                                    "vid": v_id, 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                                    "hot_l1_comment": True, 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                                    "token": "90747742180aeb22c0fe3a3c6a38f3d9", 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                                    "uid": "8fde3c6c-c070-4379-bfc4-15c7e85139c9", 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                                    "proj": "ma", 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                                    "wx_ver": "8.0.20", 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                                    "code_ver": "3.62.0", 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                                    "log_common_params": { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                                        "e": [{ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                                            "data": { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                                                "page": "dynamicSharePage" 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                                            } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                                        }], 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                                        "ext": { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                                            "brand": "iPhone", 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                                            "device": "iPhone 11", 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                                            "os": "iOS 14.7.1", 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                                            "weixinver": "8.0.20", 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                                            "srcver": "2.24.3", 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                                            "net": "wifi", 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                                            "scene": "1089" 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                                        }, 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                                        "pj": "1", 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                                        "pf": "2", 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                                        "session_id": "7bcce313-b57d-4305-8d14-6ebd9a1bad29" 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                                    } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                                } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                                urllib3.disable_warnings() 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                                r = requests.post(headers=headers, url=url, json=data, proxies=proxies, verify=False) 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                                hour_play_cnt = r.json()["data"]["play_pv"] 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                                hour_cover_url = r.json()["data"]["url"] 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                                hour_video_url = r.json()["data"]["v_url"] 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                                hour_video_duration = r.json()["data"]["du"] 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                                hour_video_comment_cnt = r.json()["data"]["comment_count"] 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                                hour_video_like_cnt = r.json()["data"]["favor"]["total"] 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                                hour_video_share_cnt = r.json()["data"]["share"] 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                                hour_video_width = r.json()["data"]["w"] 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                                hour_video_height = r.json()["data"]["h"] 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                                hour_video_resolution = str(hour_video_width) + "*" + str(hour_video_height) 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                                hour_video_send_time = r.json()["data"]["t"] 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                                hour_user_name = r.json()["data"]["user"]["nick"] 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                                hour_head_url = r.json()["data"]["user"]["hurl"] 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                                Common.logger().info("视频详情,当前播放量:{}", hour_play_cnt) 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                                # 下载封面 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                                Common.download_method("logs", "cover", v_title, hour_cover_url) 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                                # 下载视频 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                                Common.download_method("logs", "video", v_title, hour_video_url) 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                                # 保存视频信息至 "./videos/{download_video_title}/info.txt" 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                                with open("./videos/" + v_title + "/" + "info.txt", "a", encoding="UTF-8") as f_a: 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                                    f_a.write(str(v_id) + "\n" + 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                                              str(v_title) + "\n" + 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                                              str(int(int(hour_video_duration) / 1000)) + "\n" + 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                                              str(hour_play_cnt) + "\n" + 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                                              str(hour_video_comment_cnt) + "\n" + 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                                              str(hour_video_like_cnt) + "\n" + 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                                              str(hour_video_share_cnt) + "\n" + 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                                              str(hour_video_resolution) + "\n" + 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                                              str(hour_video_send_time) + "\n" + 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                                              str(hour_user_name) + "\n" + 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                                              str(hour_head_url) + "\n" + 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                                              str(hour_video_url) + "\n" + 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                                              str(hour_cover_url) + "\n" + 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                                              str("90747742180aeb22c0fe3a3c6a38f3d9")) 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                                Common.logger().info("==========视频信息已保存至info.txt==========") 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                                Common.logger().info("开始上传视频") 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                                Publish.upload_and_publish("prod", "up") 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                                Common.logger().info("视频上传完成:{}", v_title) 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                                # 上传完成时间 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                                upload_time = int(time.time()) 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                                # 保存视频信息到云文档 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                                Common.logger().info("添加视频到云文档:{}", v_title) 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                                # 插入空行 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                                time.sleep(1) 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                                Feishu.insert_columns("logs", "xiaoniangao", "yatRv2", "ROWS", 1, 2) 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                                # 视频信息写入云文档 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                                values = [[time.strftime("%Y-%m-%d %H:%M:%S", time.localtime(int(upload_time))), 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                                           "小时级上升榜", 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                                           v_id, 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                                           v_title, 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                                           hour_play_cnt, 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                                           hour_video_comment_cnt, 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                                           hour_video_like_cnt, 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                                           hour_video_share_cnt, 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                                           hour_video_duration, 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                                           hour_video_resolution, 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                                           time.strftime("%Y-%m-%d %H:%M:%S", 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                                                         time.localtime(int(hour_video_send_time) / 1000)), 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                                           hour_user_name, 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                                           p_id, 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                                           p_mid, 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                                           hour_head_url, 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                                           hour_cover_url, 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                                           hour_video_url]] 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                                time.sleep(1) 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                                Feishu.update_values("logs", "xiaoniangao", "yatRv2", "A2:Q2", values) 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                            except Exception as e: 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                                Common.logger().error("下载视频异常:{}", e) 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                        elif int(ten_cnt) >= 2000 and int(fifteen_cnt) >= 2000: 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                            Common.logger().info("10:00 and 15:00 数据上升量:{} and {} >= 2000", ten_cnt, fifteen_cnt) 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                            Common.logger().info("满足下载规则,开始下载视频") 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                            try: 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                                url = "https://kapi.xiaoniangao.cn/profile/get_profile_by_id" 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                                headers = { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                                    "x-b3-traceid": "bd267349bf41b", 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                                    "X-Token-Id": "86f6d7cc2b2b6870004df5d16c82aaf3-1185665701", 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                                    "uid": "8fde3c6c-c070-4379-bfc4-15c7e85139c9", 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                                    "content-type": "application/json", 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                                    "Accept-Encoding": "gzip,compress,br,deflate", 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                                    "User-Agent": 'Mozilla/5.0 (iPhone; CPU iPhone OS 14_7_1 like Mac OS X)' 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                                                  ' AppleWebKit/605.1.15 (KHTML, like Gecko) Mobile/15E148 ' 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                                                  'MicroMessenger/8.0.20(0x18001432) NetType/WIFI Language/zh_CN', 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                                    "Referer": "https://servicewechat.com/wxd7911e4c177690e4/617/page-frame.html" 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                                } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                                data = { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                                    "play_src": "1", 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                                    "profile_id": int(p_id), 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                                    "profile_mid": int(p_mid), 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                                    "qs": "imageMogr2/gravity/center/rotate/$/thumbnail/" 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                                          "!400x400r/crop/400x400/interlace/1/format/jpg", 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                                    "h_qs": "imageMogr2/gravity/center/rotate/$/thumbnail" 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                                            "/!80x80r/crop/80x80/interlace/1/format/jpg", 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                                    "share_width": 625, 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                                    "share_height": 500, 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                                    "no_comments": True, 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                                    "no_follow": True, 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                                    "vid": v_id, 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                                    "hot_l1_comment": True, 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                                    "token": "90747742180aeb22c0fe3a3c6a38f3d9", 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                                    "uid": "8fde3c6c-c070-4379-bfc4-15c7e85139c9", 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                                    "proj": "ma", 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                                    "wx_ver": "8.0.20", 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                                    "code_ver": "3.62.0", 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                                    "log_common_params": { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                                        "e": [{ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                                            "data": { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                                                "page": "dynamicSharePage" 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                                            } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                                        }], 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                                        "ext": { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                                            "brand": "iPhone", 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                                            "device": "iPhone 11", 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                                            "os": "iOS 14.7.1", 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                                            "weixinver": "8.0.20", 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                                            "srcver": "2.24.3", 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                                            "net": "wifi", 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                                            "scene": "1089" 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                                        }, 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                                        "pj": "1", 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                                        "pf": "2", 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                                        "session_id": "7bcce313-b57d-4305-8d14-6ebd9a1bad29" 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                                    } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                                } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                                urllib3.disable_warnings() 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                                r = requests.post(headers=headers, url=url, json=data, proxies=proxies, verify=False) 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                                hour_play_cnt = r.json()["data"]["play_pv"] 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                                hour_cover_url = r.json()["data"]["url"] 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                                hour_video_url = r.json()["data"]["v_url"] 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                                hour_video_duration = r.json()["data"]["du"] 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                                hour_video_comment_cnt = r.json()["data"]["comment_count"] 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                                hour_video_like_cnt = r.json()["data"]["favor"]["total"] 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                                hour_video_share_cnt = r.json()["data"]["share"] 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                                hour_video_width = r.json()["data"]["w"] 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                                hour_video_height = r.json()["data"]["h"] 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                                hour_video_resolution = str(hour_video_width) + "*" + str(hour_video_height) 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                                hour_video_send_time = r.json()["data"]["t"] 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                                hour_user_name = r.json()["data"]["user"]["nick"] 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                                hour_head_url = r.json()["data"]["user"]["hurl"] 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                                Common.logger().info("视频详情,当前播放量:{}", hour_play_cnt) 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                                # 下载封面 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                                Common.download_method("logs", "cover", v_title, hour_cover_url) 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                                # 下载视频 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                                Common.download_method("logs", "video", v_title, hour_video_url) 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                                # 保存视频信息至 "./videos/{download_video_title}/info.txt" 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                                with open("./videos/" + v_title + "/" + "info.txt", "a", encoding="UTF-8") as f_a: 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                                    f_a.write(str(v_id) + "\n" + 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                                              str(v_title) + "\n" + 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                                              str(int(int(hour_video_duration) / 1000)) + "\n" + 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                                              str(hour_play_cnt) + "\n" + 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                                              str(hour_video_comment_cnt) + "\n" + 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                                              str(hour_video_like_cnt) + "\n" + 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                                              str(hour_video_share_cnt) + "\n" + 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                                              str(hour_video_resolution) + "\n" + 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                                              str(hour_video_send_time) + "\n" + 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                                              str(hour_user_name) + "\n" + 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                                              str(hour_head_url) + "\n" + 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                                              str(hour_video_url) + "\n" + 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                                              str(hour_cover_url) + "\n" + 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                                              str("90747742180aeb22c0fe3a3c6a38f3d9")) 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                                Common.logger().info("==========视频信息已保存至info.txt==========") 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                                Common.logger().info("开始上传视频") 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                                Publish.upload_and_publish("prod", "up") 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                                Common.logger().info("视频上传完成:{}", v_title) 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                                # 上传完成时间 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                                upload_time = int(time.time()) 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                                # 保存视频信息到云文档 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                                Common.logger().info("添加视频到云文档:{}", v_title) 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                                # 插入空行 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                                time.sleep(1) 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                                Feishu.insert_columns("logs", "xiaoniangao", "yatRv2", "ROWS", 1, 2) 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                                # 视频信息写入云文档 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                                values = [[time.strftime("%Y-%m-%d %H:%M:%S", time.localtime(int(upload_time))), 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                                           "小时级上升榜", 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                                           v_id, 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                                           v_title, 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                                           hour_play_cnt, 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                                           hour_video_comment_cnt, 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                                           hour_video_like_cnt, 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                                           hour_video_share_cnt, 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                                           hour_video_duration, 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                                           hour_video_resolution, 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                                           time.strftime("%Y-%m-%d %H:%M:%S", 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                                                         time.localtime(int(hour_video_send_time) / 1000)), 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                                           hour_user_name, 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                                           p_id, 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                                           p_mid, 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                                           hour_head_url, 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                                           hour_cover_url, 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                                           hour_video_url]] 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                                time.sleep(1) 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                                Feishu.update_values("logs", "xiaoniangao", "yatRv2", "A2:Q2", values) 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                            except Exception as e: 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                                Common.logger().error("下载视频异常:{}", e) 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                        elif int(fifteen_cnt) >= 2000 and int(twenty_cnt) >= 2000: 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                            Common.logger().info("15:00 and 20:00 数据上升量:{} and {} >= 2000", fifteen_cnt, twenty_cnt) 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                            Common.logger().info("满足下载规则,开始下载视频") 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                            try: 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                                url = "https://kapi.xiaoniangao.cn/profile/get_profile_by_id" 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                                headers = { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                                    "x-b3-traceid": "bd267349bf41b", 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                                    "X-Token-Id": "86f6d7cc2b2b6870004df5d16c82aaf3-1185665701", 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                                    "uid": "8fde3c6c-c070-4379-bfc4-15c7e85139c9", 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                                    "content-type": "application/json", 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                                    "Accept-Encoding": "gzip,compress,br,deflate", 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                                    "User-Agent": 'Mozilla/5.0 (iPhone; CPU iPhone OS 14_7_1 like Mac OS X)' 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                                                  ' AppleWebKit/605.1.15 (KHTML, like Gecko) Mobile/15E148 ' 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                                                  'MicroMessenger/8.0.20(0x18001432) NetType/WIFI Language/zh_CN', 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                                    "Referer": "https://servicewechat.com/wxd7911e4c177690e4/617/page-frame.html" 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                                } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                                data = { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                                    "play_src": "1", 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                                    "profile_id": int(p_id), 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                                    "profile_mid": int(p_mid), 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                                    "qs": "imageMogr2/gravity/center/rotate/$/thumbnail/" 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                                          "!400x400r/crop/400x400/interlace/1/format/jpg", 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                                    "h_qs": "imageMogr2/gravity/center/rotate/$/thumbnail" 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                                            "/!80x80r/crop/80x80/interlace/1/format/jpg", 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                                    "share_width": 625, 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                                    "share_height": 500, 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                                    "no_comments": True, 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                                    "no_follow": True, 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                                    "vid": v_id, 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                                    "hot_l1_comment": True, 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                                    "token": "90747742180aeb22c0fe3a3c6a38f3d9", 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                                    "uid": "8fde3c6c-c070-4379-bfc4-15c7e85139c9", 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                                    "proj": "ma", 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                                    "wx_ver": "8.0.20", 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                                    "code_ver": "3.62.0", 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                                    "log_common_params": { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                                        "e": [{ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                                            "data": { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                                                "page": "dynamicSharePage" 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                                            } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                                        }], 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                                        "ext": { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                                            "brand": "iPhone", 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                                            "device": "iPhone 11", 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                                            "os": "iOS 14.7.1", 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                                            "weixinver": "8.0.20", 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                                            "srcver": "2.24.3", 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                                            "net": "wifi", 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                                            "scene": "1089" 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                                        }, 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                                        "pj": "1", 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                                        "pf": "2", 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                                        "session_id": "7bcce313-b57d-4305-8d14-6ebd9a1bad29" 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                                    } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                                } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                                urllib3.disable_warnings() 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                                r = requests.post(headers=headers, url=url, json=data, proxies=proxies, verify=False) 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                                hour_play_cnt = r.json()["data"]["play_pv"] 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                                hour_cover_url = r.json()["data"]["url"] 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                                hour_video_url = r.json()["data"]["v_url"] 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                                hour_video_duration = r.json()["data"]["du"] 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                                hour_video_comment_cnt = r.json()["data"]["comment_count"] 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                                hour_video_like_cnt = r.json()["data"]["favor"]["total"] 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                                hour_video_share_cnt = r.json()["data"]["share"] 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                                hour_video_width = r.json()["data"]["w"] 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                                hour_video_height = r.json()["data"]["h"] 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                                hour_video_resolution = str(hour_video_width) + "*" + str(hour_video_height) 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                                hour_video_send_time = r.json()["data"]["t"] 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                                hour_user_name = r.json()["data"]["user"]["nick"] 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                                hour_head_url = r.json()["data"]["user"]["hurl"] 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                                Common.logger().info("视频详情,当前播放量:{}", hour_play_cnt) 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                                # 下载封面 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                                Common.download_method("logs", "cover", v_title, hour_cover_url) 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                                # 下载视频 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                                Common.download_method("logs", "video", v_title, hour_video_url) 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                                # 保存视频信息至 "./videos/{download_video_title}/info.txt" 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                                with open("./videos/" + v_title + "/" + "info.txt", "a", encoding="UTF-8") as f_a: 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                                    f_a.write(str(v_id) + "\n" + 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                                              str(v_title) + "\n" + 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                                              str(int(int(hour_video_duration) / 1000)) + "\n" + 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                                              str(hour_play_cnt) + "\n" + 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                                              str(hour_video_comment_cnt) + "\n" + 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                                              str(hour_video_like_cnt) + "\n" + 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                                              str(hour_video_share_cnt) + "\n" + 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                                              str(hour_video_resolution) + "\n" + 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                                              str(hour_video_send_time) + "\n" + 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                                              str(hour_user_name) + "\n" + 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                                              str(hour_head_url) + "\n" + 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                                              str(hour_video_url) + "\n" + 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                                              str(hour_cover_url) + "\n" + 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                                              str("90747742180aeb22c0fe3a3c6a38f3d9")) 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                                Common.logger().info("==========视频信息已保存至info.txt==========") 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                                Common.logger().info("开始上传视频") 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                                Publish.upload_and_publish("prod", "up") 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                                Common.logger().info("视频上传完成:{}", v_title) 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                                # 上传完成时间 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                                upload_time = int(time.time()) 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                                # 保存视频信息到云文档 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                                Common.logger().info("添加视频到云文档:{}", v_title) 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                                # 插入空行 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                                time.sleep(1) 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                                Feishu.insert_columns("logs", "xiaoniangao", "yatRv2", "ROWS", 1, 2) 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                                # 视频信息写入云文档 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                                values = [[time.strftime("%Y-%m-%d %H:%M:%S", time.localtime(int(upload_time))), 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                                           "小时级上升榜", 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                                           v_id, 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                                           v_title, 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                                           hour_play_cnt, 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                                           hour_video_comment_cnt, 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                                           hour_video_like_cnt, 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                                           hour_video_share_cnt, 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                                           hour_video_duration, 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                                           hour_video_resolution, 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                                           time.strftime("%Y-%m-%d %H:%M:%S", 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                                                         time.localtime(int(hour_video_send_time) / 1000)), 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                                           hour_user_name, 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                                           p_id, 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                                           p_mid, 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                                           hour_head_url, 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                                           hour_cover_url, 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                                           hour_video_url]] 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                                time.sleep(1) 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                                Feishu.update_values("logs", "xiaoniangao", "yatRv2", "A2:Q2", values) 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                            except Exception as e: 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                                Common.logger().error("下载视频异常:{}", e) 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                        elif int(yesterday_twenty_cnt) >= 2000 and int(ten_cnt) >= 2000: 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                            Common.logger().info("昨日20:00 and 今日10:00 数据上升量:{} and {} >= 2000", 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                                                 yesterday_twenty_cnt, ten_cnt) 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                            Common.logger().info("满足下载规则,开始下载视频") 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                            try: 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                                url = "https://kapi.xiaoniangao.cn/profile/get_profile_by_id" 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                                headers = { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                                    "x-b3-traceid": "bd267349bf41b", 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                                    "X-Token-Id": "86f6d7cc2b2b6870004df5d16c82aaf3-1185665701", 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                                    "uid": "8fde3c6c-c070-4379-bfc4-15c7e85139c9", 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                                    "content-type": "application/json", 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                                    "Accept-Encoding": "gzip,compress,br,deflate", 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                                    "User-Agent": 'Mozilla/5.0 (iPhone; CPU iPhone OS 14_7_1 like Mac OS X)' 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                                                  ' AppleWebKit/605.1.15 (KHTML, like Gecko) Mobile/15E148 ' 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                                                  'MicroMessenger/8.0.20(0x18001432) NetType/WIFI Language/zh_CN', 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                                    "Referer": "https://servicewechat.com/wxd7911e4c177690e4/617/page-frame.html" 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                                } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                                data = { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                                    "play_src": "1", 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                                    "profile_id": int(p_id), 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                                    "profile_mid": int(p_mid), 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                                    "qs": "imageMogr2/gravity/center/rotate/$/thumbnail/" 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                                          "!400x400r/crop/400x400/interlace/1/format/jpg", 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                                    "h_qs": "imageMogr2/gravity/center/rotate/$/thumbnail" 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                                            "/!80x80r/crop/80x80/interlace/1/format/jpg", 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                                    "share_width": 625, 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                                    "share_height": 500, 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                                    "no_comments": True, 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                                    "no_follow": True, 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                                    "vid": v_id, 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                                    "hot_l1_comment": True, 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                                    "token": "90747742180aeb22c0fe3a3c6a38f3d9", 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                                    "uid": "8fde3c6c-c070-4379-bfc4-15c7e85139c9", 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                                    "proj": "ma", 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                                    "wx_ver": "8.0.20", 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                                    "code_ver": "3.62.0", 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                                    "log_common_params": { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                                        "e": [{ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                                            "data": { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                                                "page": "dynamicSharePage" 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                                            } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                                        }], 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                                        "ext": { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                                            "brand": "iPhone", 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                                            "device": "iPhone 11", 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                                            "os": "iOS 14.7.1", 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                                            "weixinver": "8.0.20", 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                                            "srcver": "2.24.3", 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                                            "net": "wifi", 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                                            "scene": "1089" 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                                        }, 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                                        "pj": "1", 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                                        "pf": "2", 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                                        "session_id": "7bcce313-b57d-4305-8d14-6ebd9a1bad29" 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                                    } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                                } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                                urllib3.disable_warnings() 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                                r = requests.post(headers=headers, url=url, json=data, proxies=proxies, verify=False) 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                                hour_play_cnt = r.json()["data"]["play_pv"] 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                                hour_cover_url = r.json()["data"]["url"] 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                                hour_video_url = r.json()["data"]["v_url"] 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                                hour_video_duration = r.json()["data"]["du"] 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                                hour_video_comment_cnt = r.json()["data"]["comment_count"] 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                                hour_video_like_cnt = r.json()["data"]["favor"]["total"] 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                                hour_video_share_cnt = r.json()["data"]["share"] 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                                hour_video_width = r.json()["data"]["w"] 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                                hour_video_height = r.json()["data"]["h"] 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                                hour_video_resolution = str(hour_video_width) + "*" + str(hour_video_height) 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                                hour_video_send_time = r.json()["data"]["t"] 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                                hour_user_name = r.json()["data"]["user"]["nick"] 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                                hour_head_url = r.json()["data"]["user"]["hurl"] 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                                Common.logger().info("视频详情,当前播放量:{}", hour_play_cnt) 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                                # 下载封面 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                                Common.download_method("logs", "cover", v_title, hour_cover_url) 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                                # 下载视频 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                                Common.download_method("logs", "video", v_title, hour_video_url) 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                                # 保存视频信息至 "./videos/{download_video_title}/info.txt" 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                                with open("./videos/" + v_title + "/" + "info.txt", "a", encoding="UTF-8") as f_a: 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                                    f_a.write(str(v_id) + "\n" + 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                                              str(v_title) + "\n" + 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                                              str(int(int(hour_video_duration) / 1000)) + "\n" + 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                                              str(hour_play_cnt) + "\n" + 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                                              str(hour_video_comment_cnt) + "\n" + 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                                              str(hour_video_like_cnt) + "\n" + 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                                              str(hour_video_share_cnt) + "\n" + 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                                              str(hour_video_resolution) + "\n" + 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                                              str(hour_video_send_time) + "\n" + 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                                              str(hour_user_name) + "\n" + 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                                              str(hour_head_url) + "\n" + 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                                              str(hour_video_url) + "\n" + 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                                              str(hour_cover_url) + "\n" + 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                                              str("90747742180aeb22c0fe3a3c6a38f3d9")) 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                                Common.logger().info("==========视频信息已保存至info.txt==========") 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                                Common.logger().info("开始上传视频") 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                                Publish.upload_and_publish("prod", "up") 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                                Common.logger().info("视频上传完成:{}", v_title) 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                                # 上传完成时间 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                                upload_time = int(time.time()) 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                                # 保存视频信息到云文档 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                                Common.logger().info("添加视频到云文档:{}", v_title) 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                                # 插入空行 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                                time.sleep(1) 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                                Feishu.insert_columns("logs", "xiaoniangao", "yatRv2", "ROWS", 1, 2) 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                                # 视频信息写入云文档 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                                values = [[time.strftime("%Y-%m-%d %H:%M:%S", time.localtime(int(upload_time))), 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                                           "小时级上升榜", 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                                           v_id, 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                                           v_title, 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                                           hour_play_cnt, 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                                           hour_video_comment_cnt, 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                                           hour_video_like_cnt, 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                                           hour_video_share_cnt, 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                                           hour_video_duration, 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                                           hour_video_resolution, 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                                           time.strftime("%Y-%m-%d %H:%M:%S", 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                                                         time.localtime(int(hour_video_send_time) / 1000)), 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                                           hour_user_name, 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                                           p_id, 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                                           p_mid, 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                                           hour_head_url, 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                                           hour_cover_url, 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                                           hour_video_url]] 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                                time.sleep(1) 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                                Feishu.update_values("logs", "xiaoniangao", "yatRv2", "A2:Q2", values) 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                            except Exception as e: 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                                Common.logger().error("下载视频异常:{}", e) 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                        else: 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                            Common.logger().info("上升量不满足下载规则") 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        except Exception as e: 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+            Common.logger().error("下载视频时,获取飞书信息异常:{}", e) 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				  
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 if __name__ == "__main__": 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				     hour_list = HourList() 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-    hour_list.get_hour_list_feeds() 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+    # hour_list.get_hour_list_feeds() 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				     # hour_list.del_null_rows("xiaoniangao", "ba0da4", 3) 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-    hour_list.update_hour_list_data(today="", yesterday="", before_yesterday="") 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+    # hour_list.update_hour_list_data( 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+    #     today=datetime.datetime.now().strftime("%Y-%m-%d"), 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+    #     yesterday=(datetime.date.today() + datetime.timedelta(days=-1)).strftime("%Y-%m-%d"), 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+    #     before_yesterday=(datetime.date.today() + datetime.timedelta(days=-2)).strftime("%Y-%m-%d")) 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+    hour_list.download_and_publish() 
			 |