zhangyong 9 mēneši atpakaļ
vecāks
revīzija
e0a6201f75

+ 2 - 2
common/feishu_utils.py

@@ -319,7 +319,7 @@ class Feishu:
             url = "https://open.feishu.cn/open-apis/bot/v2/hook/e7697dc6-5254-4411-8b59-3cd0742bf703"
             headers = {'Content-Type': 'application/json'}
             if crawler == "机器自动改造消息通知":
-                sheet_url = "https://w42nne6hzg.feishu.cn/sheets/S8jusgF83h8gEKtILW4cli2Bngf?sheet=3e1295"
+                sheet_url = "https://w42nne6hzg.feishu.cn/sheets/KsoMsyP2ghleM9tzBfmcEEXBnXg?sheet=bc154d"
                 users = f"<at id=" + str(cls.get_userid(log_type)) + f">{mark_name}</at>"
 
             data = json.dumps({
@@ -350,7 +350,7 @@ class Feishu:
                     }],
                     "header": {
                         "title": {
-                            "content": "📣消息来喽~~~",
+                            "content": "📣Cookie 过期提醒",
                             "tag": "plain_text"
                         }
                     }

+ 16 - 20
common/tts_help.py

@@ -16,25 +16,21 @@ 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://videopre.piaoquantv.com/longvideoapi/producevideo/listeningTextSpeech"
-
-            payload = {
-                "machineCode": "fd5287b1-ccde-46db-8068-e50a58231a1a",
-                "appType": "8",
-                "produceVoiceConfigJson": '{"voice":"zhiyuan","channel":"aliyun","speechRate":0,"pitchRate":0,"volume":100}',
-                "text": text,
-                "versionName": "2.5.2",
-                "buildCode": "38",
-                "versionCode": "38",
-                "token": "9396f509996e4575a7733f59604719efec6fde7a"
-            }
+            url = "http://api.piaoquantv.com/produce-center/speechSynthesis"
+            payload = json.dumps({
+                "params": {
+                    "text": text,
+                    "vocie": "zhiyuan",
+                    "format": "pcm",
+                    "volume": 70,
+                    "speechRate": 0,
+                    "pitchRate": 0
+                }
+            })
 
             headers = {
-                'Cookie': 'JSESSIONID=1204A84BECB3CB8AD3FDF765E57E2942'
+                'Content-Type': 'application/json'
             }
-
-
             wait_time = random.uniform(1, 10)
             time.sleep(wait_time)
             try:
@@ -46,13 +42,13 @@ class TTS:
                     return mp3
                 else:
                     if attempt == max_retries - 1:
-                        Feishu.bot("zhangyong", '机器自动改造消息通知', f'获取字幕音频cookie过期,请及时更换', '张勇')
+                        Feishu.bot("zhangyong", '机器自动改造消息通知', f'获取字幕音频失败,请关注', '张勇')
                         return None
             except Exception:
                 if attempt == max_retries - 1:
-                    Feishu.bot("zhangyong", '机器自动改造消息通知', f'获取字幕音频cookie过期,请及时更换', '张勇')
+                    Feishu.bot("zhangyong", '机器自动改造消息通知', f'获取字幕音频失败,请关注', '张勇')
                     return None
-        Feishu.bot("zhangyong", '机器自动改造消息通知', f'获取字幕音频cookie过期,请及时更换', '张勇')
+        Feishu.bot("zhangyong", '机器自动改造消息通知', f'获取字幕音频失败,请关注', '张勇')
 
 
 
@@ -260,7 +256,7 @@ if __name__ == '__main__':
     # ]
     # subprocess.run(command)
     # print("完成")
-    video_file = 'http://clipres.yishihui.com/longvideo/material/voice/pre/20240820/3f930929584e4af8b7c2d1552536ac891724162309557'
+    video_file = 'http://clipres.yishihui.com/longvideo/crawler/voice/pre/20240821/37fbb8cfc7f1439b8d8a032a1d01d37f1724219959925.mp3'
     TTS.getSrt(video_file)
     # result = subprocess.run(
     #     ["ffprobe", "-v", "error", "-show_entries", "format=duration",

+ 4 - 1
data_channel/douyin.py

@@ -54,7 +54,10 @@ class DY:
             next_cursor = str(obj.get('max_cursor')) if has_more else None
             data = obj.get('aweme_list', [])
             if data == [] and len(data) == 0:
-                Feishu.bot(mark, '机器自动改造消息通知', f'抖音cookie过期,请及时更换', name)
+                if name == '抖音品类账号' or name == '抖音品类账号-1':
+                    Feishu.bot("wangxueke", '机器自动改造消息通知', f'{name}cookie过期,请及时更换', 'wangxueke')
+                else:
+                    Feishu.bot(mark, '机器自动改造消息通知', f'{name}cookie过期,请及时更换', name)
                 return list
             response.close()
             for i in range(len(data)):

+ 12 - 3
data_channel/kuaishou.py

@@ -75,15 +75,24 @@ class KS:
             if response.status_code != 200:
                 return list
             elif "visionProfilePhotoList" not in response.json()["data"]:
-                Feishu.bot(mark, '机器自动改造消息通知', f'快手cookie过期,请及时更换', name)
+                if name == '快手品类账号':
+                    Feishu.bot("wangxueke", '机器自动改造消息通知', f'{name}cookie过期,请及时更换', 'wangxueke')
+                else:
+                    Feishu.bot(mark, '机器自动改造消息通知', f'{name}cookie过期,请及时更换', name)
                 time.sleep(900)
                 continue
             elif "feeds" not in response.json()["data"]["visionProfilePhotoList"]:
-                Feishu.bot(mark, '机器自动改造消息通知', f'快手cookie过期,请及时更换', name)
+                if name == '快手品类账号':
+                    Feishu.bot("wangxueke", '机器自动改造消息通知', f'{name}cookie过期,请及时更换', 'wangxueke')
+                else:
+                    Feishu.bot(mark, '机器自动改造消息通知', f'{name}cookie过期,请及时更换', name)
                 time.sleep(900)
                 continue
             elif len(response.json()["data"]["visionProfilePhotoList"]["feeds"]) == 0:
-                Feishu.bot(mark, '机器自动改造消息通知', f'快手cookie使用频繁无法获取到数据,请及时更换', name)
+                if name == '快手品类账号':
+                    Feishu.bot("wangxueke", '机器自动改造消息通知', f'{name}cookie过期,请及时更换', 'wangxueke')
+                else:
+                    Feishu.bot(mark, '机器自动改造消息通知', f'{name}cookie使用频繁无法获取到数据,请及时更换', name)
                 time.sleep(900)
                 continue
             pcursor = response.json()['data']['visionProfilePhotoList']['pcursor']

+ 5 - 5
video_rewriting/video_processor.py

@@ -361,12 +361,12 @@ class VideoProcessor:
                 pw_url = TTS.get_pw_zm(pw_srt_text)
                 if pw_url:
                     pw_mp3_path = TTS.download_mp3(pw_url, video_path_url, pw_random_id)
-                    oss_mp3_key = Oss.mp3_upload_oss(pw_mp3_path, pw_random_id)
-                    oss_mp3_key = oss_mp3_key.get("oss_object_key")
-                    new_pw_path = f"http://art-crawler.oss-cn-hangzhou.aliyuncs.com/{oss_mp3_key}"
-                    print(f"mp3地址:{new_pw_path}")
+                    # oss_mp3_key = Oss.mp3_upload_oss(pw_mp3_path, pw_random_id)
+                    # oss_mp3_key = oss_mp3_key.get("oss_object_key")
+                    # new_pw_path = f"http://art-crawler.oss-cn-hangzhou.aliyuncs.com/{oss_mp3_key}"
+                    # print(f"mp3地址:{new_pw_path}")
                     # pw_url_sec = FFmpeg.get_video_duration(pw_mp3_path)
-                    pw_srt = TTS.getSrt(new_pw_path)
+                    pw_srt = TTS.getSrt(pw_url)
                     Common.logger(mark).info(f"{name}的{task_mark}下的视频{url},获取AI片尾srt成功")
                 else:
                     Feishu.bot(mark, 'TTS获取失败提示', f'无法获取到片尾音频,及时更换token', "张勇")