zhangyong 9 місяців тому
батько
коміт
5b78ca4366

+ 6 - 4
common/tts_help.py

@@ -8,6 +8,7 @@ import re
 import time
 from pydub import AudioSegment
 
+from common import Material
 
 
 class TTS:
@@ -16,6 +17,7 @@ class TTS:
     def get_pw_zm(cls, text):
         max_retries = 3
         for attempt in range(max_retries):
+            token = Material.get_cookie_data("KsoMsyP2ghleM9tzBfmcEEXBnXg", "U1gySe", "硅语")
             url = "https://zh.api.guiji.cn/avatar2c/tool/sec_tts"
 
             payload = json.dumps({
@@ -29,12 +31,12 @@ class TTS:
                 'origin': 'https://app.guiji.cn',
                 'pragma': 'no-cache',
                 'referer': 'https://app.guiji.cn/',
-                'token': 'f16e8bfcae6049d6b68b21f945bd00ad'
+                'token': token
             }
             wait_time = random.uniform(5, 20)
             time.sleep(wait_time)
-            response = requests.request("POST", url, headers=headers, data=payload)
             try:
+                response = requests.request("POST", url, headers=headers, data=payload)
                 response = response.json()
                 code = response["code"]
                 if code == 200:
@@ -207,8 +209,8 @@ if __name__ == '__main__':
     # ]
     # subprocess.run(command)
     # print("完成")
-    video_file = 'https://digital-public.obs.myhuaweicloud.com/vcm_server/20240715/KnOgRTYKvZbWD2EX_ms/FwA2SEh7DZQGlwAe.wav'
-    TTS.getSrt(video_file)
+    video_file = '"千钧"中的“钧”是古代的一种重量单位,1钧等于30斤。因此,“千钧”就是1000钧,等于30,000斤。'
+    TTS.get_pw_zm(video_file)
     # result = subprocess.run(
     #     ["ffprobe", "-v", "error", "-show_entries", "format=duration",
     #      "-of", "default=noprint_wrappers=1:nokey=1", video_file],

+ 5 - 3
data_channel/douyin.py

@@ -77,20 +77,22 @@ class DY:
                             .replace(">", "").replace("|", "").replace(" ", "") \
                             .replace("&NBSP", "").replace(".", "。").replace(" ", "") \
                             .replace("'", "").replace("#", "").replace("Merge", "")
+                        Common.logger("dy").info(
+                            f"扫描:{task_mark},用户主页id:{url_id},视频id{video_id} ,分享:{share_count},点赞{digg_count} ,时长:{duration} ")
                         if share_count < 500:
                             Common.logger("dy").info(
-                                f"任务:{task_mark},用户主页id:{url_id},视频id{video_id} ,分享:{share_count},点赞{digg_count}")
+                                f"不符合规则:{task_mark},用户主页id:{url_id},视频id{video_id} ,分享:{share_count},点赞{digg_count}")
                             continue
                         video_percent = '%.2f' % (share_count / digg_count)
                         special = float(0.25)
                         if float(video_percent) < special:
                             Common.logger("dy").info(
-                                f"任务:{task_mark},用户主页id:{url_id},视频id{video_id} ,分享:{share_count},点赞{digg_count} ")
+                                f"不符合规则:{task_mark},用户主页id:{url_id},视频id{video_id} ,分享:{share_count},点赞{digg_count} ")
                             continue
                         duration = dataHelp.video_duration(video_url)
                         if int(duration) < 30 or int(duration) > 720:
                             Common.logger("dy").info(
-                                f"任务:{task_mark},用户主页id:{url_id},视频id{video_id} ,分享:{share_count},点赞{digg_count} ,时长:{duration} ")
+                                f"不符合规则:{task_mark},用户主页id:{url_id},视频id{video_id} ,分享:{share_count},点赞{digg_count} ,时长:{duration} ")
                             continue
                         cover_url = data[i].get('video').get('cover').get('url_list')[0]  # 视频封面
                         all_data = {"video_id": video_id, "cover": cover_url, "video_url": video_url, "rule": video_percent, "old_title": old_title}

+ 3 - 1
data_channel/kuaishou.py

@@ -106,10 +106,12 @@ class KS:
                         realLikeCount = int(feeds[i].get('photo', {}).get('realLikeCount', 0))
                         video_percent = '%.4f' % (share_count / view_count)
                         duration = dataHelp.video_duration(video_url)
+                        Common.logger("ks").info(
+                            f"扫描:{task_mark},用户主页id:{url_id},视频id{video_id} ,播放数:{view_count} ,分享数:{share_count},时长:{duration} ")
                         special = float(0.001)
                         if float(video_percent) < special or share_count < 500 or duration < 30 or duration > 720:
                             Common.logger("ks").info(
-                                f"任务:{task_mark},用户主页id:{url_id},视频id{video_id} ,播放数:{view_count} ,分享数:{share_count},时长:{duration} ")
+                                f"不符合规则:{task_mark},用户主页id:{url_id},视频id{video_id} ,播放数:{view_count} ,分享数:{share_count},时长:{duration} ")
                             continue
                         all_data = {"video_id": video_id, "cover": cover_url, "video_url": video_url, "rule": video_percent, "old_title": old_title}
                         list.append(all_data)

+ 4 - 2
data_channel/shipinhao.py

@@ -104,15 +104,17 @@ class SPH:
                             share_cnt = int(obj['forward_count'])  # 分享
                             like_cnt = int(obj['like_count'])  # 点赞
                             old_title = video_obj.get('title').split("\n")[0].split("#")[0]
+                            Common.logger("sph").info(
+                                f"扫描:{task_mark},用户主页id:{url},视频id{objectId} ,分享:{share_cnt},点赞:{like_cnt} ,时长:{duration} ")
                             if share_cnt < 500:
                                 Common.logger("sph").info(
-                                    f"任务:{task_mark},用户主页id:{url},视频id{objectId} ,分享:{share_cnt},点赞:{like_cnt}")
+                                    f"不符合规则:{task_mark},用户主页id:{url},视频id{objectId} ,分享:{share_cnt},点赞:{like_cnt}")
                                 continue
                             video_percent = '%.2f' % (share_cnt / like_cnt)
                             special = float(0.25)
                             if float(video_percent) < special:
                                 Common.logger("sph").info(
-                                    f"任务:{task_mark},用户主页id:{url},视频id{objectId} ,分享:{share_cnt},点赞:{like_cnt}")
+                                    f"不符合规则:{task_mark},用户主页id:{url},视频id{objectId} ,分享:{share_cnt},点赞:{like_cnt}")
                                 continue
                             duration = dataHelp.video_duration(video_url)
                             if int(duration) < 30 or int(duration) > 720:

+ 1 - 1
video_rewriting/video_prep.py

@@ -321,7 +321,7 @@ class getVideo:
                     cls.remove_files(video_path_url)
                     Common.logger("warning").warning(f"{name}的{task_mark}任务处理失败:{e}\n")
 
-        batch_size = 1
+        batch_size = 2
         with concurrent.futures.ThreadPoolExecutor(max_workers=batch_size) as executor:
             index = 0
             while index < len(task_data):