|  | @@ -45,27 +45,13 @@ class Recommend:
 | 
	
		
			
				|  |  |      @classmethod
 | 
	
		
			
				|  |  |      def get_video_info_from_local(cls, video_path):
 | 
	
		
			
				|  |  |          probe = ffmpeg.probe(video_path)
 | 
	
		
			
				|  |  | -        # print('video_path: {}'.format(video_path))
 | 
	
		
			
				|  |  | -        # format1 = probe['format']
 | 
	
		
			
				|  |  | -        # bit_rate = int(format1['bit_rate']) / 1000
 | 
	
		
			
				|  |  | -        # duration = format['duration']
 | 
	
		
			
				|  |  | -        # size = int(format1['size']) / 1024 / 1024
 | 
	
		
			
				|  |  |          video_stream = next((stream for stream in probe['streams'] if stream['codec_type'] == 'video'), None)
 | 
	
		
			
				|  |  |          if video_stream is None:
 | 
	
		
			
				|  |  |              print('No video stream found!')
 | 
	
		
			
				|  |  |              return
 | 
	
		
			
				|  |  |          width = int(video_stream['width'])
 | 
	
		
			
				|  |  |          height = int(video_stream['height'])
 | 
	
		
			
				|  |  | -        # num_frames = int(video_stream['nb_frames'])
 | 
	
		
			
				|  |  | -        # fps = int(video_stream['r_frame_rate'].split('/')[0]) / int(video_stream['r_frame_rate'].split('/')[1])
 | 
	
		
			
				|  |  |          duration = float(video_stream['duration'])
 | 
	
		
			
				|  |  | -        # print('width: {}'.format(width))
 | 
	
		
			
				|  |  | -        # print('height: {}'.format(height))
 | 
	
		
			
				|  |  | -        # print('num_frames: {}'.format(num_frames))
 | 
	
		
			
				|  |  | -        # print('bit_rate: {}k'.format(bit_rate))
 | 
	
		
			
				|  |  | -        # print('fps: {}'.format(fps))
 | 
	
		
			
				|  |  | -        # print('size: {}MB'.format(size))
 | 
	
		
			
				|  |  | -        # print('duration: {}'.format(duration))
 | 
	
		
			
				|  |  |          return width, height, duration
 | 
	
		
			
				|  |  |  
 | 
	
		
			
				|  |  |      # 推荐列表获取视频
 | 
	
	
		
			
				|  | @@ -115,15 +101,6 @@ class Recommend:
 | 
	
		
			
				|  |  |              cls.visitor_key = r.json()["data"]["visitor_key"]
 | 
	
		
			
				|  |  |              cls.page += 1
 | 
	
		
			
				|  |  |  
 | 
	
		
			
				|  |  | -            # Common.logger(log_type).info("visitor_key:{}", cls.visitor_key)
 | 
	
		
			
				|  |  | -            # Common.logger(log_type).info("page:{}\n", cls.page)
 | 
	
		
			
				|  |  | -            #
 | 
	
		
			
				|  |  | -            # for k, v in parameter.items():
 | 
	
		
			
				|  |  | -            #     Common.logger(log_type).info("{}:{}", k, v)
 | 
	
		
			
				|  |  | -            # Common.logger(log_type).info("\n")
 | 
	
		
			
				|  |  | -            #
 | 
	
		
			
				|  |  | -            # Common.logger(log_type).info("response:{}\n", response)
 | 
	
		
			
				|  |  | -
 | 
	
		
			
				|  |  |              if "data" not in response:
 | 
	
		
			
				|  |  |                  Common.logger(log_type).warning("get_recommend, response:{}".format(response))
 | 
	
		
			
				|  |  |                  time.sleep(3)
 | 
	
	
		
			
				|  | @@ -147,15 +124,6 @@ class Recommend:
 | 
	
		
			
				|  |  |                      else:
 | 
	
		
			
				|  |  |                          video_url = feeds[i]["video_url"]
 | 
	
		
			
				|  |  |  
 | 
	
		
			
				|  |  | -                    # if "width" not in feeds[i] or "height" not in feeds[i]:
 | 
	
		
			
				|  |  | -                    #     video_width = 0
 | 
	
		
			
				|  |  | -                    #     video_height = 0
 | 
	
		
			
				|  |  | -                    #     video_resolution = str(video_width) + "*" + str(video_height)
 | 
	
		
			
				|  |  | -                    # else:
 | 
	
		
			
				|  |  | -                    #     video_width = feeds[i]["width"]
 | 
	
		
			
				|  |  | -                    #     video_height = feeds[i]["height"]
 | 
	
		
			
				|  |  | -                    #     video_resolution = str(video_width) + "*" + str(video_height)
 | 
	
		
			
				|  |  | -
 | 
	
		
			
				|  |  |                      if "commentCount" not in feeds[i]:
 | 
	
		
			
				|  |  |                          video_comment_cnt = 0
 | 
	
		
			
				|  |  |                      else:
 | 
	
	
		
			
				|  | @@ -186,12 +154,9 @@ class Recommend:
 | 
	
		
			
				|  |  |                      user_id = "benshanzhufu"
 | 
	
		
			
				|  |  |                      Common.logger(log_type).info("video_title:{}".format(video_title))
 | 
	
		
			
				|  |  |                      Common.logger(log_type).info("video_id:{}".format(video_id))
 | 
	
		
			
				|  |  | -                    # Common.logger(log_type).info("video_comment_cnt:{}".format(video_comment_cnt))
 | 
	
		
			
				|  |  | -                    # Common.logger(log_type).info("video_resolution:{}".format(video_resolution))
 | 
	
		
			
				|  |  |                      Common.logger(log_type).info(
 | 
	
		
			
				|  |  |                          "video_send_time:{}", time.strftime(
 | 
	
		
			
				|  |  |                              "%Y/%m/%d %H:%M:%S", time.localtime(int(video_send_time))))
 | 
	
		
			
				|  |  | -                    # Common.logger(log_type).info("video_cover:{}".format(cover_url))
 | 
	
		
			
				|  |  |                      Common.logger(log_type).info("video_url:{}".format(video_url))
 | 
	
		
			
				|  |  |  
 | 
	
		
			
				|  |  |                      # 过滤无效视频
 | 
	
	
		
			
				|  | @@ -259,15 +224,6 @@ class Recommend:
 | 
	
		
			
				|  |  |                  Common.logger(log_type).info("download_video_title:{}", download_video_title)
 | 
	
		
			
				|  |  |                  Common.logger(log_type).info("download_video_send_time:{}", download_video_send_time)
 | 
	
		
			
				|  |  |                  Common.logger(log_type).info("download_video_url:{}", download_video_url)
 | 
	
		
			
				|  |  | -                # Common.logger(log_type).info("download_video_play_cnt:{}", download_video_play_cnt)
 | 
	
		
			
				|  |  | -                # Common.logger(log_type).info("download_video_id:{}", download_video_id)
 | 
	
		
			
				|  |  | -                # Common.logger(log_type).info("download_video_comment_cnt:{}", download_video_comment_cnt)
 | 
	
		
			
				|  |  | -                # Common.logger(log_type).info("download_video_like_cnt:{}", download_video_like_cnt)
 | 
	
		
			
				|  |  | -                # Common.logger(log_type).info("download_video_share_cnt:{}", download_video_share_cnt)
 | 
	
		
			
				|  |  | -                # Common.logger(log_type).info("download_user_name:{}", download_user_name)
 | 
	
		
			
				|  |  | -                # Common.logger(log_type).info("download_user_id:{}", download_user_id)
 | 
	
		
			
				|  |  | -                # Common.logger(log_type).info("download_head_url:{}", download_head_url)
 | 
	
		
			
				|  |  | -                # Common.logger(log_type).info("download_cover_url:{}", download_cover_url)
 | 
	
		
			
				|  |  |  
 | 
	
		
			
				|  |  |                  # 过滤空行
 | 
	
		
			
				|  |  |                  if download_video_id is None or download_video_title is None or download_video_play_cnt is None:
 | 
	
	
		
			
				|  | @@ -294,13 +250,13 @@ class Recommend:
 | 
	
		
			
				|  |  |                      download_video_resolution = str(video_info[0]) + "*" + str(video_info[1])
 | 
	
		
			
				|  |  |                      download_video_duration = video_info[2]
 | 
	
		
			
				|  |  |  
 | 
	
		
			
				|  |  | -                    # 视频时长<60s,直接删除
 | 
	
		
			
				|  |  | -                    if int(download_video_duration) < 60:
 | 
	
		
			
				|  |  | +                    # 视频时长<40s,直接删除
 | 
	
		
			
				|  |  | +                    if int(download_video_duration) < 40:
 | 
	
		
			
				|  |  |                          # 删除视频文件夹
 | 
	
		
			
				|  |  |                          shutil.rmtree("./videos/" + download_video_title + "/")
 | 
	
		
			
				|  |  |                          # 删除云文档recommend_feeds中的记录
 | 
	
		
			
				|  |  |                          Feishu.dimension_range(log_type, "bszf", "CcHgO7", "ROWS", i + 1, i + 1)
 | 
	
		
			
				|  |  | -                        Common.logger(log_type).info("时长:{}<60秒,删除成功\n", int(download_video_duration))
 | 
	
		
			
				|  |  | +                        Common.logger(log_type).info("时长:{}<40秒,删除成功\n", int(download_video_duration))
 | 
	
		
			
				|  |  |                          return
 | 
	
		
			
				|  |  |                      # # 竖版视频不下载,写入竖版视频表
 | 
	
		
			
				|  |  |                      # elif int(video_info[0]) < int(video_info[1]):
 |