Browse Source

Merge branch 'master' of https://git.yishihui.com/Server/piaoquan_crawler

lierqiang 2 years ago
parent
commit
7e62cf7981
1 changed files with 6 additions and 2 deletions
  1. 6 2
      gongzhonghao/gongzhonghao_follow/gongzhonghao_follow.py

+ 6 - 2
gongzhonghao/gongzhonghao_follow/gongzhonghao_follow.py

@@ -8,6 +8,8 @@ import os
 import shutil
 import sys
 import time
+from hashlib import md5
+
 import requests
 import urllib3
 from selenium.webdriver import DesiredCapabilities
@@ -335,7 +337,8 @@ class GongzhonghaoFollow:
                                         f"./{crawler}/videos/{video_dict['video_title']}/video.mp4")
             if ffmpeg_dict is None:
                 # 删除视频文件夹
-                shutil.rmtree(f"./{crawler}/videos/{video_dict['video_title']}")
+                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"]
@@ -349,7 +352,8 @@ class GongzhonghaoFollow:
             # 视频size=0,直接删除
             if int(video_size) == 0 or cls.download_rule(video_dict) is False:
                 # 删除视频文件夹
-                shutil.rmtree(f"./{crawler}/videos/{video_dict['video_title']}")
+                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
             # 下载封面