| 
					
				 | 
			
			
				@@ -31,151 +31,151 @@ class Recommend: 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				  
			 | 
		
	
		
			
				 | 
				 | 
			
			
				     @classmethod 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				     def get_feeds(cls, log_type, env): 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-        # try: 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-        while True: 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-            url = 'https://www.jzkksp.com/index/home/get_home_list.html' 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-            headers = { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-                'content-type': 'application/x-www-form-urlencoded', 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-                'Accept-Encoding': 'gzip,compress,br,deflate', 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-                'User-Agent': 'Mozilla/5.0 (iPhone; CPU iPhone OS 13_3_1 like Mac OS X) ' 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-                              'AppleWebKit/605.1.15 (KHTML, like Gecko) ' 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-                              'Mobile/15E148 MicroMessenger/8.0.25(0x1800192b) NetType/WIFI Language/zh_CN', 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-                'Referer': 'https://servicewechat.com/wxd4c54f60812f6f36/1/page-frame.html', 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-            } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-            cls.page += 1 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-            data = { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-                'token': '851ae159fd33f955bf433e7c47a4a298', 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-                'time': '1667905857000', 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-                'str_data': 'uT551tU8', 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-                'page': str(cls.page), 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-                'limit': '10', 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-                'appid': 'wxd4c54f60812f6f36', 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-                'version': '1.4.1', 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-                'openid': 'oDAjy5SCFe7Ml3PNgiow3ncozL1o' 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-            } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-            urllib3.disable_warnings() 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-            response = requests.post(url=url, headers=headers, data=data, verify=False) 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-            if 'data' not in response.json(): 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-                Common.logger(log_type).warning('response:{}\n', response.text) 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-                cls.page = 0 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-                return 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-            elif len(response.json()['data']['video_list']['data']) == 0: 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-                Common.logger(log_type).warning('response:{}', response.json()) 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-                Common.logger(log_type).info('视频列表返回空,退出\n') 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-                cls.page = 0 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-                return 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-            else: 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-                feeds = response.json()['data']['video_list']['data'] 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-                Common.logger(log_type).info('page:{}\n', cls.page) 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-                for i in range(len(feeds)): 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-                    # video_title 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-                    if 'title' not in feeds[i]: 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-                        video_title = 0 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-                    else: 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-                        video_title = feeds[i]['title'] 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				- 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-                    # video_id 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-                    if 'id' not in feeds[i]: 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-                        video_id = 0 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-                    else: 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-                        video_id = feeds[i]['id'] 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				- 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-                    # play_cnt 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-                    if 'browse' not in feeds[i]: 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-                        play_cnt = 0 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-                    else: 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-                        play_cnt = feeds[i]['browse'] 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				- 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-                    # publish_time 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-                    if 'createtime' not in feeds[i]: 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-                        publish_time = 0 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-                    else: 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-                        publish_time = feeds[i]['createtime'] 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				- 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-                    # cover_url 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-                    if 'thumb' not in feeds[i]: 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-                        cover_url = 0 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-                    else: 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-                        cover_url = feeds[i]['thumb'] 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				- 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-                    # video_url 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-                    if 'url' not in feeds[i]: 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-                        video_url = 0 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-                    else: 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-                        video_url = feeds[i]['url'] 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				- 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-                    Common.logger(log_type).info('video_title:{}', video_title) 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-                    Common.logger(log_type).info('video_id:{}', video_id) 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-                    Common.logger(log_type).info('play_cnt:{}', play_cnt) 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-                    Common.logger(log_type).info('publish_time:{}', publish_time) 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-                    Common.logger(log_type).info('cover_url:{}', cover_url) 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-                    Common.logger(log_type).info('video_url:{}', video_url) 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				- 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-                    if video_id == 0 or video_title == 0 or cover_url == 0 or video_url == 0: 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-                        Common.logger(log_type).info('无效视频\n') 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-                    elif int(video_id) in [x for y in Feishu.get_values_batch(log_type, 'ssnnyfq', '290bae') for x in y]: 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-                        Common.logger(log_type).info('视频已下载\n') 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-                    else: 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-                        Common.download_method(log_type, 'cover', video_title, cover_url) 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-                        Common.download_method(log_type, 'video', video_title, video_url) 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-                        # 获取视频时长 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-                        video_info = cls.get_video_info_from_local( 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-                            "./videos/" + video_title + "/video.mp4") 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-                        video_width = str(video_info[0]) 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-                        video_height = str(video_info[1]) 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-                        duration = video_info[2] 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-                        # 保存视频信息至 "./videos/{download_video_title}/info.txt" 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-                        with open("./videos/" + video_title 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-                                  + "/" + "info.txt", "a", encoding="UTF-8") as f_a: 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-                            f_a.write("ssnnyfq" + str(int(time.time())) + "\n" + 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-                                      str(video_title) + "\n" + 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-                                      str(int(duration)) + "\n" + 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-                                      str(play_cnt) + "\n" + 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-                                      '0' + "\n" + 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-                                      '0' + "\n" + 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-                                      '0' + "\n" + 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-                                      str(video_width) + '*' + str(video_height) + "\n" + 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-                                      str(int(time.time())) + "\n" + 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-                                      '岁岁年年迎福气小程序' + "\n" + 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-                                      str(cover_url) + "\n" + 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-                                      str(video_url) + "\n" + 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-                                      str(cover_url) + "\n" + 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-                                      "suisuiniannianyingfuqi" + str(int(time.time()))) 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-                        Common.logger(log_type).info("==========视频信息已保存至info.txt==========") 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				- 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-                        # 上传视频 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-                        Common.logger(log_type).info("开始上传视频:{}".format(video_title)) 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-                        if env == 'dev': 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-                            our_video_id = Publish.upload_and_publish(log_type, env, "width") 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-                            our_video_link = "https://testadmin.piaoquantv.com/cms/post-detail/" + str( 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-                                our_video_id) + "/info" 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        try: 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+            while True: 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                url = 'https://www.jzkksp.com/index/home/get_home_list.html' 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                headers = { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                    'content-type': 'application/x-www-form-urlencoded', 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                    'Accept-Encoding': 'gzip,compress,br,deflate', 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                    'User-Agent': 'Mozilla/5.0 (iPhone; CPU iPhone OS 13_3_1 like Mac OS X) ' 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                                  'AppleWebKit/605.1.15 (KHTML, like Gecko) ' 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                                  'Mobile/15E148 MicroMessenger/8.0.25(0x1800192b) NetType/WIFI Language/zh_CN', 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                    'Referer': 'https://servicewechat.com/wxd4c54f60812f6f36/1/page-frame.html', 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                cls.page += 1 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                data = { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                    'token': '851ae159fd33f955bf433e7c47a4a298', 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                    'time': '1667905857000', 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                    'str_data': 'uT551tU8', 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                    'page': str(cls.page), 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                    'limit': '10', 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                    'appid': 'wxd4c54f60812f6f36', 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                    'version': '1.4.1', 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                    'openid': 'oDAjy5SCFe7Ml3PNgiow3ncozL1o' 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                urllib3.disable_warnings() 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                response = requests.post(url=url, headers=headers, data=data, verify=False) 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                if 'data' not in response.json(): 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                    Common.logger(log_type).warning('response:{}\n', response.text) 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                    cls.page = 0 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                    return 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                elif len(response.json()['data']['video_list']['data']) == 0: 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                    Common.logger(log_type).warning('response:{}', response.json()) 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                    Common.logger(log_type).info('视频列表返回空,退出\n') 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                    cls.page = 0 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                    return 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                else: 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                    feeds = response.json()['data']['video_list']['data'] 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                    Common.logger(log_type).info('page:{}\n', cls.page) 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                    for i in range(len(feeds)): 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                        # video_title 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                        if 'title' not in feeds[i]: 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                            video_title = 0 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                         else: 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-                            our_video_id = Publish.upload_and_publish(log_type, env, "width") 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-                            our_video_link = "https://admin.piaoquantv.com/cms/post-detail/" + str( 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-                                our_video_id) + "/info" 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-                        Common.logger(log_type).info("视频上传完成,保存至已下载表") 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				- 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-                        # 视频ID工作表,插入首行 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-                        Feishu.insert_columns(log_type, "ssnnyfq", "290bae", "ROWS", 1, 2) 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-                        # 视频ID工作表,首行写入数据 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-                        upload_time = int(time.time()) 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-                        values = [[time.strftime("%Y/%m/%d %H:%M:%S", time.localtime(upload_time)), 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-                                   "推荐榜", 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-                                   video_title, 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-                                   video_id, 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-                                   our_video_link, 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-                                   play_cnt, 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-                                   int(duration), 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-                                   str(video_width) + '*' + str(video_height), 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-                                   cover_url, 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-                                   video_url]] 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-                        time.sleep(1) 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-                        Feishu.update_values(log_type, "ssnnyfq", "290bae", "F2:V2", values) 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-                        Common.logger(log_type).info("视频:{},下载/上传成功,随机休眠 10-30 秒\n", video_title) 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-                        time.sleep(random.randint(10, 30)) 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				- 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-        # except Exception as e: 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-        #     Common.logger(log_type).error('get_feeds异常:{}\n', e) 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                            video_title = feeds[i]['title'] 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                        # video_id 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                        if 'id' not in feeds[i]: 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                            video_id = 0 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                        else: 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                            video_id = feeds[i]['id'] 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                        # play_cnt 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                        if 'browse' not in feeds[i]: 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                            play_cnt = 0 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                        else: 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                            play_cnt = feeds[i]['browse'] 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                        # publish_time 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                        if 'createtime' not in feeds[i]: 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                            publish_time = 0 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                        else: 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                            publish_time = feeds[i]['createtime'] 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                        # cover_url 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                        if 'thumb' not in feeds[i]: 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                            cover_url = 0 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                        else: 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                            cover_url = feeds[i]['thumb'] 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                        # video_url 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                        if 'url' not in feeds[i]: 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                            video_url = 0 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                        else: 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                            video_url = feeds[i]['url'] 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                        Common.logger(log_type).info('video_title:{}', video_title) 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                        Common.logger(log_type).info('video_id:{}', video_id) 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                        Common.logger(log_type).info('play_cnt:{}', play_cnt) 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                        Common.logger(log_type).info('publish_time:{}', publish_time) 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                        Common.logger(log_type).info('cover_url:{}', cover_url) 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                        Common.logger(log_type).info('video_url:{}', video_url) 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                        if video_id == 0 or video_title == 0 or cover_url == 0 or video_url == 0: 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                            Common.logger(log_type).info('无效视频\n') 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                        elif int(video_id) in [x for y in Feishu.get_values_batch(log_type, 'ssnnyfq', '290bae') for x in y]: 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                            Common.logger(log_type).info('视频已下载\n') 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                        else: 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                            Common.download_method(log_type, 'cover', video_title, cover_url) 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                            Common.download_method(log_type, 'video', video_title, video_url) 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                            # 获取视频时长 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                            video_info = cls.get_video_info_from_local( 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                                "./videos/" + video_title + "/video.mp4") 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                            video_width = str(video_info[0]) 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                            video_height = str(video_info[1]) 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                            duration = video_info[2] 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                            # 保存视频信息至 "./videos/{download_video_title}/info.txt" 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                            with open("./videos/" + video_title 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                                      + "/" + "info.txt", "a", encoding="UTF-8") as f_a: 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                                f_a.write("ssnnyfq" + str(int(time.time())) + "\n" + 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                                          str(video_title) + "\n" + 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                                          str(int(duration)) + "\n" + 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                                          str(play_cnt) + "\n" + 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                                          '0' + "\n" + 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                                          '0' + "\n" + 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                                          '0' + "\n" + 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                                          str(video_width) + '*' + str(video_height) + "\n" + 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                                          str(int(time.time())) + "\n" + 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                                          '岁岁年年迎福气小程序' + "\n" + 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                                          str(cover_url) + "\n" + 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                                          str(video_url) + "\n" + 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                                          str(cover_url) + "\n" + 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                                          "suisuiniannianyingfuqi" + str(int(time.time()))) 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                            Common.logger(log_type).info("==========视频信息已保存至info.txt==========") 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                            # 上传视频 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                            Common.logger(log_type).info("开始上传视频:{}".format(video_title)) 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                            if env == 'dev': 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                                our_video_id = Publish.upload_and_publish(log_type, env, "width") 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                                our_video_link = "https://testadmin.piaoquantv.com/cms/post-detail/" + str( 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                                    our_video_id) + "/info" 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                            else: 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                                our_video_id = Publish.upload_and_publish(log_type, env, "width") 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                                our_video_link = "https://admin.piaoquantv.com/cms/post-detail/" + str( 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                                    our_video_id) + "/info" 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                            Common.logger(log_type).info("视频上传完成,保存至已下载表") 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                            # 视频ID工作表,插入首行 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                            Feishu.insert_columns(log_type, "ssnnyfq", "290bae", "ROWS", 1, 2) 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                            # 视频ID工作表,首行写入数据 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                            upload_time = int(time.time()) 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                            values = [[time.strftime("%Y/%m/%d %H:%M:%S", time.localtime(upload_time)), 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                                       "推荐榜", 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                                       video_title, 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                                       video_id, 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                                       our_video_link, 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                                       play_cnt, 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                                       int(duration), 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                                       str(video_width) + '*' + str(video_height), 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                                       cover_url, 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                                       video_url]] 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                            time.sleep(1) 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                            Feishu.update_values(log_type, "ssnnyfq", "290bae", "F2:V2", values) 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                            Common.logger(log_type).info("视频:{},下载/上传成功,随机休眠 10-30 秒\n", video_title) 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                            time.sleep(random.randint(10, 30)) 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        except Exception as e: 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+            Common.logger(log_type).error('get_feeds异常:{}\n', e) 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				  
			 | 
		
	
		
			
				 | 
				 | 
			
			
				  
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 if __name__ == '__main__': 
			 |