|
@@ -332,30 +332,36 @@ class GongzhonghaoFollow:
|
|
|
# 下载视频
|
|
|
Common.download_method(log_type=log_type, crawler=crawler, text="video",
|
|
|
title=video_dict["video_title"], url=video_dict["video_url"])
|
|
|
- # 获取视频时长
|
|
|
- ffmpeg_dict = Common.ffmpeg(log_type, crawler,
|
|
|
- f"./{crawler}/videos/{video_dict['video_title']}/video.mp4")
|
|
|
- if ffmpeg_dict is None:
|
|
|
- # 删除视频文件夹
|
|
|
- md_title = md5(video_dict['video_title'].encode('utf8')).hexdigest()
|
|
|
- shutil.rmtree(f"./{crawler}/videos/{md_title}")
|
|
|
- Common.logger(log_type, crawler).info("视频size=0,删除成功\n")
|
|
|
- return
|
|
|
- video_dict["video_width"] = ffmpeg_dict["width"]
|
|
|
- video_dict["video_height"] = ffmpeg_dict["height"]
|
|
|
- video_dict["duration"] = ffmpeg_dict["duration"]
|
|
|
- video_size = ffmpeg_dict["size"]
|
|
|
- Common.logger(log_type, crawler).info(f'video_width:{video_dict["video_width"]}')
|
|
|
- Common.logger(log_type, crawler).info(f'video_height:{video_dict["video_height"]}')
|
|
|
- Common.logger(log_type, crawler).info(f'duration:{video_dict["duration"]}')
|
|
|
- Common.logger(log_type, crawler).info(f'video_size:{video_size}')
|
|
|
- # 视频size=0,直接删除
|
|
|
- if int(video_size) == 0 or cls.download_rule(video_dict) is False:
|
|
|
+ if os.path.getsize(f"./{crawler}/videos/{video_dict['video_title']}/video.mp4") == 0:
|
|
|
# 删除视频文件夹
|
|
|
md_title = md5(video_dict['video_title'].encode('utf8')).hexdigest()
|
|
|
shutil.rmtree(f"./{crawler}/videos/{md_title}")
|
|
|
Common.logger(log_type, crawler).info("视频size=0,删除成功\n")
|
|
|
return
|
|
|
+ # # 获取视频时长
|
|
|
+ # ffmpeg_dict = Common.ffmpeg(log_type, crawler,
|
|
|
+ # f"./{crawler}/videos/{video_dict['video_title']}/video.mp4")
|
|
|
+ # if ffmpeg_dict is None:
|
|
|
+ # # 删除视频文件夹
|
|
|
+ # md_title = md5(video_dict['video_title'].encode('utf8')).hexdigest()
|
|
|
+ # shutil.rmtree(f"./{crawler}/videos/{md_title}")
|
|
|
+ # Common.logger(log_type, crawler).info("视频size=0,删除成功\n")
|
|
|
+ # return
|
|
|
+ # video_dict["video_width"] = ffmpeg_dict["width"]
|
|
|
+ # video_dict["video_height"] = ffmpeg_dict["height"]
|
|
|
+ # video_dict["duration"] = ffmpeg_dict["duration"]
|
|
|
+ # video_size = ffmpeg_dict["size"]
|
|
|
+ # Common.logger(log_type, crawler).info(f'video_width:{video_dict["video_width"]}')
|
|
|
+ # Common.logger(log_type, crawler).info(f'video_height:{video_dict["video_height"]}')
|
|
|
+ # Common.logger(log_type, crawler).info(f'duration:{video_dict["duration"]}')
|
|
|
+ # Common.logger(log_type, crawler).info(f'video_size:{video_size}')
|
|
|
+ # # 视频size=0,直接删除
|
|
|
+ # if int(video_size) == 0 or cls.download_rule(video_dict) is False:
|
|
|
+ # # 删除视频文件夹
|
|
|
+ # md_title = md5(video_dict['video_title'].encode('utf8')).hexdigest()
|
|
|
+ # shutil.rmtree(f"./{crawler}/videos/{md_title}")
|
|
|
+ # Common.logger(log_type, crawler).info("视频size=0,删除成功\n")
|
|
|
+ # return
|
|
|
# 下载封面
|
|
|
Common.download_method(log_type=log_type, crawler=crawler, text="cover",
|
|
|
title=video_dict["video_title"], url=video_dict["cover_url"])
|