Kaynağa Gözat

增加日志

zhangyong 5 ay önce
ebeveyn
işleme
41ac9258de

+ 99 - 95
data_channel/douyin.py

@@ -17,101 +17,105 @@ class DY:
     def get_dy_url(cls, task_mark, url_id, number, mark, feishu_id, cookie_sheet, channel_id, name):
         list = []
         next_cursor = 0
-        for i in range(6):
-            cookie = Material.get_cookie_data(feishu_id, cookie_sheet, channel_id)
-            time.sleep(random.randint(1, 5))
-            url = 'https://www.douyin.com/aweme/v1/web/aweme/post/'
-            headers = {
-                'Accept': 'application/json, text/plain, */*',
-                'Accept-Language': 'zh-CN,zh;q=0.9',
-                'Cache-Control': 'no-cache',
-                'Cookie': cookie,
-                'Pragma': 'no-cache',
-                'Referer': f'https://www.douyin.com/user/{url_id}',
-                'User-Agent': 'Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_7) AppleWebKit/537.36 (KHTML, like Gecko) '
-                              'Chrome/118.0.0.0 Safari/537.36',
-            }
-            query = DouYinHelper.get_full_query(ua=headers['User-Agent'], extra_data={
-                'sec_user_id': url_id,
-                'max_cursor': next_cursor,
-                'locate_query': 'false',
-                'show_live_replay_strategy': '1',
-                'need_time_list': '1',
-                'time_list_query': '0',
-                'whale_cut_token': '',
-                'cut_version': '1',
-                'count': '18',
-                'publish_video_strategy_type': '2',
-            })
-            urllib3.disable_warnings()
-            s = requests.session()
-            s.mount('http://', HTTPAdapter(max_retries=3))
-            s.mount('https://', HTTPAdapter(max_retries=3))
-            response = requests.request(method='GET', url=url, headers=headers, params=query)
-            body = response.content.decode()
-            obj = json.loads(body)
-            has_more = True if obj.get('has_more', 0) == 1 else False
-            next_cursor = str(obj.get('max_cursor')) if has_more else None
-            data = obj.get('aweme_list', [])
-            if data == [] and len(data) == 0:
-                if name == '抖音品类账号' or name == '抖音品类账号-1':
-                    Feishu.bot("wangxueke", '机器自动改造消息通知', f'抖音-{name}cookie过期,请及时更换', '王雪珂')
-                    Feishu.bot("xinxin", '机器自动改造消息通知', f'抖音-{name}cookie过期,请及时更换', '信欣')
-                else:
-                    Feishu.bot(mark, '机器自动改造消息通知', f'抖音-{name}cookie过期,请及时更换', name)
-                return list
-            response.close()
-            for i in range(len(data)):
-                entity_type = data[i].get('media_type')
-                if entity_type == 4:
-                    # is_top = data[i].get('is_top')  # 是否置顶
-                    video_id = data[i].get('aweme_id')  # 文章id
-                    status = sqlCollect.is_used(task_mark, video_id, mark, channel_id)
+        try:
+            for i in range(6):
+                cookie = Material.get_cookie_data(feishu_id, cookie_sheet, channel_id)
+                time.sleep(random.randint(1, 5))
+                url = 'https://www.douyin.com/aweme/v1/web/aweme/post/'
+                headers = {
+                    'Accept': 'application/json, text/plain, */*',
+                    'Accept-Language': 'zh-CN,zh;q=0.9',
+                    'Cache-Control': 'no-cache',
+                    'Cookie': cookie,
+                    'Pragma': 'no-cache',
+                    'Referer': f'https://www.douyin.com/user/{url_id}',
+                    'User-Agent': 'Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_7) AppleWebKit/537.36 (KHTML, like Gecko) '
+                                  'Chrome/118.0.0.0 Safari/537.36',
+                }
+                query = DouYinHelper.get_full_query(ua=headers['User-Agent'], extra_data={
+                    'sec_user_id': url_id,
+                    'max_cursor': next_cursor,
+                    'locate_query': 'false',
+                    'show_live_replay_strategy': '1',
+                    'need_time_list': '1',
+                    'time_list_query': '0',
+                    'whale_cut_token': '',
+                    'cut_version': '1',
+                    'count': '18',
+                    'publish_video_strategy_type': '2',
+                })
+                urllib3.disable_warnings()
+                s = requests.session()
+                s.mount('http://', HTTPAdapter(max_retries=3))
+                s.mount('https://', HTTPAdapter(max_retries=3))
+                response = requests.request(method='GET', url=url, headers=headers, params=query)
+                body = response.content.decode()
+                obj = json.loads(body)
+                has_more = True if obj.get('has_more', 0) == 1 else False
+                next_cursor = str(obj.get('max_cursor')) if has_more else None
+                data = obj.get('aweme_list', [])
+                if data == [] and len(data) == 0:
+                    if name == '抖音品类账号' or name == '抖音品类账号-1':
+                        Feishu.bot("wangxueke", '机器自动改造消息通知', f'抖音-{name}cookie过期,请及时更换', '王雪珂')
+                        Feishu.bot("xinxin", '机器自动改造消息通知', f'抖音-{name}cookie过期,请及时更换', '信欣')
+                    else:
+                        Feishu.bot(mark, '机器自动改造消息通知', f'抖音-{name}cookie过期,请及时更换', name)
+                    return list
+                response.close()
+                for i in range(len(data)):
+                    entity_type = data[i].get('media_type')
+                    if entity_type == 4:
+                        # is_top = data[i].get('is_top')  # 是否置顶
+                        video_id = data[i].get('aweme_id')  # 文章id
+                        status = sqlCollect.is_used(task_mark, video_id, mark, channel_id)
 
-                    video_uri = data[i].get('video', {}).get('play_addr', {}).get('uri')
-                    ratio = f'{data[i].get("video", {}).get("height")}p'
-                    video_url = f'https://www.iesdouyin.com/aweme/v1/play/?video_id={video_uri}&ratio={ratio}&line=0'  # 视频链接
-                    digg_count = int(data[i].get('statistics').get('digg_count'))  # 点赞
-                    # comment_count = int(data[i].get('statistics').get('comment_count'))  # 评论
-                    share_count = int(data[i].get('statistics').get('share_count'))  # 转发
-                    old_title = data[i].get('desc', "").strip().replace("\n", "") \
-                        .replace("/", "").replace("\\", "").replace("\r", "") \
-                        .replace(":", "").replace("*", "").replace("?", "") \
-                        .replace("?", "").replace('"', "").replace("<", "") \
-                        .replace(">", "").replace("|", "").replace(" ", "") \
-                        .replace("&NBSP", "").replace(".", "。").replace(" ", "") \
-                        .replace("'", "").replace("#", "").replace("Merge", "")
-                    duration = dataHelp.video_duration(video_url)
-                    Common.logger("dy").info(
-                        f"扫描:{task_mark},用户主页id:{url_id},视频id{video_id} ,分享:{share_count},点赞{digg_count}")
-                    log_data = f"user:{url_id},,video_id:{video_id},,video_url:{video_url},,original_title:{old_title},,share_count:{share_count},,digg_count:{digg_count},,duration:{duration}"
-                    AliyunLogger.logging(channel_id, name, url_id, video_id, "扫描到一条视频", "2001", log_data)
-                    if status:
-                        AliyunLogger.logging(channel_id, name, url_id, video_id, "该视频已改造过", "2001", log_data)
-                        continue
-                    if share_count < 200:
-                        AliyunLogger.logging(channel_id, name, url_id, video_id, "不符合规则:分享小于200", "2003", log_data)
+                        video_uri = data[i].get('video', {}).get('play_addr', {}).get('uri')
+                        ratio = f'{data[i].get("video", {}).get("height")}p'
+                        video_url = f'https://www.iesdouyin.com/aweme/v1/play/?video_id={video_uri}&ratio={ratio}&line=0'  # 视频链接
+                        digg_count = int(data[i].get('statistics').get('digg_count'))  # 点赞
+                        # comment_count = int(data[i].get('statistics').get('comment_count'))  # 评论
+                        share_count = int(data[i].get('statistics').get('share_count'))  # 转发
+                        old_title = data[i].get('desc', "").strip().replace("\n", "") \
+                            .replace("/", "").replace("\\", "").replace("\r", "") \
+                            .replace(":", "").replace("*", "").replace("?", "") \
+                            .replace("?", "").replace('"', "").replace("<", "") \
+                            .replace(">", "").replace("|", "").replace(" ", "") \
+                            .replace("&NBSP", "").replace(".", "。").replace(" ", "") \
+                            .replace("'", "").replace("#", "").replace("Merge", "")
+                        duration = dataHelp.video_duration(video_url)
                         Common.logger("dy").info(
-                            f"不符合规则:{task_mark},用户主页id:{url_id},视频id{video_id} ,分享:{share_count},点赞{digg_count}")
-                        continue
-                    video_percent = '%.2f' % (share_count / digg_count)
-                    special = float(0.15)
-                    if float(video_percent) < special:
-                        AliyunLogger.logging(channel_id, name, url_id, video_id, "不符合规则:分享/点赞小于0.15", "2003", log_data)
-                        Common.logger("dy").info(
-                            f"不符合规则:{task_mark},用户主页id:{url_id},视频id{video_id} ,分享:{share_count},点赞{digg_count} ")
-                        continue
+                            f"扫描:{task_mark},用户主页id:{url_id},视频id{video_id} ,分享:{share_count},点赞{digg_count}")
+                        log_data = f"user:{url_id},,video_id:{video_id},,video_url:{video_url},,original_title:{old_title},,share_count:{share_count},,digg_count:{digg_count},,duration:{duration}"
+                        AliyunLogger.logging(channel_id, name, url_id, video_id, "扫描到一条视频", "2001", log_data)
+                        if status:
+                            AliyunLogger.logging(channel_id, name, url_id, video_id, "该视频已改造过", "2002", log_data)
+                            continue
+                        if share_count < 200:
+                            AliyunLogger.logging(channel_id, name, url_id, video_id, "不符合规则:分享小于200", "2003", log_data)
+                            Common.logger("dy").info(
+                                f"不符合规则:{task_mark},用户主页id:{url_id},视频id{video_id} ,分享:{share_count},点赞{digg_count}")
+                            continue
+                        video_percent = '%.2f' % (share_count / digg_count)
+                        special = float(0.15)
+                        if float(video_percent) < special:
+                            AliyunLogger.logging(channel_id, name, url_id, video_id, "不符合规则:分享/点赞小于0.15", "2003", log_data)
+                            Common.logger("dy").info(
+                                f"不符合规则:{task_mark},用户主页id:{url_id},视频id{video_id} ,分享:{share_count},点赞{digg_count} ")
+                            continue
 
-                    if int(duration) < 30 or int(duration) > 720:
-                        AliyunLogger.logging(channel_id, name, url_id, video_id, "不符合规则:时长不符合规则大于720秒/小于30秒", "2003", log_data)
-                        Common.logger("dy").info(
-                            f"不符合规则:{task_mark},用户主页id:{url_id},视频id{video_id} ,分享:{share_count},点赞{digg_count} ,时长:{duration} ")
-                        continue
-                    AliyunLogger.logging(channel_id, name, url_id, video_id, "符合规则等待改造", "2004", log_data)
-                    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}
-                    list.append(all_data)
-                    if len(list) == int(number):
-                        Common.logger(mark).info(f"获取抖音视频总数:{len(list)}\n")
-                        return list
-        return list
+                        if int(duration) < 30 or int(duration) > 720:
+                            AliyunLogger.logging(channel_id, name, url_id, video_id, "不符合规则:时长不符合规则大于720秒/小于30秒", "2003", log_data)
+                            Common.logger("dy").info(
+                                f"不符合规则:{task_mark},用户主页id:{url_id},视频id{video_id} ,分享:{share_count},点赞{digg_count} ,时长:{duration} ")
+                            continue
+                        AliyunLogger.logging(channel_id, name, url_id, video_id, "符合规则等待改造", "2004", log_data)
+                        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}
+                        list.append(all_data)
+                        if len(list) == int(number):
+                            Common.logger(mark).info(f"获取抖音视频总数:{len(list)}\n")
+                            return list
+            return list
+        except Exception as exc:
+            Common.logger("dy").info(f"抖音历史数据获取失败:{exc}\n")
+            return list

+ 1 - 1
data_channel/dy_keyword.py

@@ -75,7 +75,7 @@ class DyKeyword:
                 Common.logger("dy-key-word").info(
                     f"扫描:{task_mark},搜索词:{keyword},视频id{video_id} ,分享:{share_count},点赞{digg_count}")
                 if status:
-                    AliyunLogger.logging(channel_id, name, keyword, video_id, "该视频已改造过", "2001", log_data)
+                    AliyunLogger.logging(channel_id, name, keyword, video_id, "该视频已改造过", "2002", log_data)
                     continue
                 video_percent = '%.2f' % (int(share_count) / int(digg_count))
                 if int(share_count) < share_count_rule:

+ 1 - 1
data_channel/dy_ls.py

@@ -61,7 +61,7 @@ class DYLS:
                     Common.logger("dy-ls").info(
                         f"扫描:{task_mark},用户主页id:{url_id},视频id{video_id} ,分享:{share_count},点赞{digg_count}")
                     if status:
-                        AliyunLogger.logging(channel_id, name, url_id, video_id, "该视频已改造过", "2001", log_data)
+                        AliyunLogger.logging(channel_id, name, url_id, video_id, "该视频已改造过", "2002", log_data)
                         continue
                     video_percent = '%.2f' % (int(share_count) / int(digg_count))
                     special = float(0.25)

+ 4 - 1
data_channel/ks_keyword.py

@@ -80,7 +80,7 @@ class KsKeyword:
 
                 AliyunLogger.logging(channel_id, name, keyword, photo_id, "扫描到一条视频", "2001", log_data)
                 if status:
-                    AliyunLogger.logging(channel_id, name, keyword, photo_id, "该视频已改造过", "2001", log_data)
+                    AliyunLogger.logging(channel_id, name, keyword, photo_id, "该视频已改造过", "2002", log_data)
                     continue
                 if float(video_percent) < special:
                     AliyunLogger.logging(channel_id, name, keyword, photo_id, f"不符合规则:分享/浏览{special}", "2003", log_data)
@@ -109,6 +109,9 @@ class KsKeyword:
                                 "rule": video_percent,
                                 "old_title": old_title}
                     list.append(all_data)
+                else:
+                    AliyunLogger.logging(channel_id, name, photo_id, photo_id, "无法获取到视频链接", "2003", log_data)
+                    continue
             return list
         except Exception as exc:
             Common.logger("ks-key-word").info(f"快手搜索词{keyword}获取失败{exc}\n")

+ 32 - 27
data_channel/ks_ls.py

@@ -12,31 +12,32 @@ class KSLS:
         #  快手app
         url = "http://47.236.68.175:8889/crawler/kuai_shou/blogger"
         next_cursor = ""
-        for i in range(20):
-            payload = json.dumps({
-                "account_id": url_id,
-                "sort_type": "最热",
-                "cursor": next_cursor
-            })
-            headers = {
-                'Content-Type': 'application/json'
-            }
-            time.sleep(random.randint(1, 5))
-            response = requests.request("POST", url, headers=headers, data=payload)
-            response = response.json()
-            list = []
-            data_all_list = response["data"]
-            if data_all_list == None or len(data_all_list) == 0:
-                try:
-                    if int(response["cdoe"]) == 27006:
-                        Feishu.finish_bot("kuai_shou/blogger接口"+response["msg"],
-                                          "https://open.feishu.cn/open-apis/bot/v2/hook/575ca6a1-84b4-4a2f-983b-1d178e7b16eb", "【快手 Token 使用提示 】")
-                except Exception as exc:
-                    return list
+        try:
+            for i in range(20):
+                payload = json.dumps({
+                    "account_id": url_id,
+                    "sort_type": "最热",
+                    "cursor": next_cursor
+                })
+                headers = {
+                    'Content-Type': 'application/json'
+                }
+                time.sleep(random.randint(1, 5))
+                response = requests.request("POST", url, headers=headers, data=payload)
+                response = response.json()
+                list = []
+                data_all_list = response["data"]
+                if data_all_list == None or len(data_all_list) == 0:
+                    try:
+                        if int(response["cdoe"]) == 27006:
+                            Feishu.finish_bot("kuai_shou/blogger接口"+response["msg"],
+                                              "https://open.feishu.cn/open-apis/bot/v2/hook/575ca6a1-84b4-4a2f-983b-1d178e7b16eb", "【快手 Token 使用提示 】")
+                    except Exception as exc:
+                        return list
+
+                has_more = data_all_list["has_more"]
+                next_cursor = str(data_all_list["next_cursor"])
 
-            has_more = data_all_list["has_more"]
-            next_cursor = str(data_all_list["next_cursor"])
-            try:
                 data_list = data_all_list["data"]
                 for data in data_list:
                     photo_id = data["photo_id"]
@@ -54,7 +55,7 @@ class KSLS:
 
                     AliyunLogger.logging(channel_id, name, url_id, photo_id, "扫描到一条视频", "2001", log_data)
                     if status:
-                        AliyunLogger.logging(channel_id, name, url_id, photo_id, "该视频已改造过", "2001", log_data)
+                        AliyunLogger.logging(channel_id, name, url_id, photo_id, "该视频已改造过", "2002", log_data)
                         continue
                     if float(video_percent) < special:
                         AliyunLogger.logging(channel_id, name, url_id, photo_id, "不符合规则:分享/浏览小于0.0005", "2003", log_data)
@@ -85,11 +86,15 @@ class KSLS:
                         if len(list) == int(number):
                             Common.logger("ks-ls").info(f"获取快手历史视频总数:{len(list)}\n")
                             return list
+                    else:
+                        AliyunLogger.logging(channel_id, name, url_id, photo_id, "无法获取到视频链接", "2003", log_data)
+                        continue
                 if has_more == False:
                     return list
-            except Exception as exc:
-                Common.logger("ks-ls").info(f"快手历史数据获取失败:{exc}\n")
                 return list
+        except Exception as exc:
+            Common.logger("ks-ls").info(f"快手历史数据获取失败:{exc}\n")
+            return list
 
     @classmethod
     def get_video(cls, video_id):

+ 29 - 29
data_channel/kuaishou.py

@@ -69,35 +69,35 @@ class KS:
             s.mount('http://', HTTPAdapter(max_retries=3))
             s.mount('https://', HTTPAdapter(max_retries=3))
             # response = requests.request("POST", url, headers=headers, data=payload, timeout=10)
-
-            response = s.post(url=url, headers=headers, data=payload, verify=False, timeout=10)
-            response.close()
-            if response.status_code != 200:
-                return list
-            elif "visionProfilePhotoList" not in response.json()["data"]:
-                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"]:
-                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:
-                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']
-            feeds = response.json()['data']['visionProfilePhotoList']['feeds']
             try:
+                response = s.post(url=url, headers=headers, data=payload, verify=False, timeout=10)
+                response.close()
+                if response.status_code != 200:
+                    return list
+                elif "visionProfilePhotoList" not in response.json()["data"]:
+                    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"]:
+                    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:
+                    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']
+                feeds = response.json()['data']['visionProfilePhotoList']['feeds']
+
                 for i in range(len(feeds)):
                     # try:
                     #     video_id = feeds[i].get("photo", {}).get("videoResource").get("h264", {}).get("videoId", "")
@@ -125,7 +125,7 @@ class KS:
                     Common.logger("ks").info(
                         f"扫描:{task_mark},用户主页id:{url_id},视频id{video_id} ,播放数:{view_count} ,分享数:{share_count},时长:{duration} ")
                     if status:
-                        AliyunLogger.logging(channel_id, name, url_id, video_id, "该视频已改造过", "2001", log_data)
+                        AliyunLogger.logging(channel_id, name, url_id, video_id, "该视频已改造过", "2002", log_data)
                         continue
                     special = float(0.001)
                     if float(video_percent) < special:

+ 7 - 5
data_channel/piaoquan.py

@@ -112,11 +112,13 @@ class PQ:
             'user-agent': 'Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_7) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/124.0.0.0 Safari/537.36'
         }
 
-        response = requests.request("GET", url, headers=headers, data=payload)
-        data = response.json()
+
+        list = []
         try:
+            response = requests.request("GET", url, headers=headers, data=payload)
+            data = response.json()
             content = data["content"]["objs"]
-            list = []
+
             for url in content:
                 video_id = url["id"]
                 status = sqlCollect.is_used(task_mark, video_id, mark, "票圈")
@@ -128,7 +130,7 @@ class PQ:
                 AliyunLogger.logging(channel_id, name, user_id, video_id, "扫描到一条视频", "2001", log_data)
 
                 if status:
-                    AliyunLogger.logging(channel_id, name, user_id, video_id, "该视频已改造过", "2001", log_data)
+                    AliyunLogger.logging(channel_id, name, user_id, video_id, "该视频已改造过", "2002", log_data)
                     continue
                 AliyunLogger.logging(channel_id, name, user_id, video_id, "符合规则等待改造", "2004", log_data)
                 all_data = {"video_id": video_id, "cover": cover, "video_url": video_url, "rule": "无", "old_title": old_title}
@@ -140,7 +142,7 @@ class PQ:
             return list
         except Exception as e:
             Common.logger("pq").warning(f"获取音频视频链接失败:{e}\n")
-            return ""
+            return list
 
     """
     获取封面

+ 1 - 1
data_channel/shipinhao.py

@@ -102,7 +102,7 @@ class SPH:
                         Common.logger("sph").info(
                             f"扫描:{task_mark},用户主页id:{url_id},视频id{objectId} ,分享:{share_cnt},点赞:{like_cnt}")
                         if status:
-                            AliyunLogger.logging(channel_id, name, url_id, objectId, "该视频已改造过", "2001", log_data)
+                            AliyunLogger.logging(channel_id, name, url_id, objectId, "该视频已改造过", "2002", log_data)
                             continue
                         video_percent = '%.2f' % (share_cnt / like_cnt)
                         special = float(0.25)

+ 1 - 1
data_channel/sph_keyword.py

@@ -62,7 +62,7 @@ class SphKeyword:
                     f"扫描:{task_mark},搜索词:{keyword},视频id{video_id},点赞{digg_count}")
                 status = sqlCollect.is_used(task_mark, video_id, mark, channel_id)
                 if status:
-                    AliyunLogger.logging(channel_id, name, keyword, video_id, "该视频已改造过", "2001", log_data)
+                    AliyunLogger.logging(channel_id, name, keyword, video_id, "该视频已改造过", "2002", log_data)
                     continue
                 if int(digg_count) < 2000:
                     AliyunLogger.logging(channel_id, name, keyword, video_id, f"不符合规则:点赞小于2000", "2003",

+ 2 - 2
data_channel/sph_ls.py

@@ -25,7 +25,7 @@ class SPHLS:
                 AliyunLogger.logging(channel_id, name, url, video_id, "扫描到一条视频", "2001", log_data)
 
                 if status:
-                    AliyunLogger.logging(channel_id, name, url, video_id, "该视频已改造过", "2001", log_data)
+                    AliyunLogger.logging(channel_id, name, url, video_id, "该视频已改造过", "2002", log_data)
                     continue
                 if share_cnt < 300:
                     AliyunLogger.logging(channel_id, name, url, video_id, "不符合规则:分享小于300", "2003", log_data)
@@ -55,7 +55,7 @@ class SPHLS:
             return list
         else:
             Common.logger("sph-ls").info(f"{url}无数据\n")
-            return None
+            return list
 
 
 

+ 11 - 9
video_rewriting/video_processor.py

@@ -107,7 +107,6 @@ class VideoProcessor:
             voice = random.choice(voices)
         else:
             voice = "zhifeng_emo"
-
         zm = Material.get_pzsrt_data("summary", "500Oe0", video_share)
         Common.logger(mark).info(f"{name}的{task_mark}下{channel_id}的用户:{url}开始获取视频")
         new_count = None
@@ -212,6 +211,7 @@ class VideoProcessor:
                                     f"**原视频封面**: {video['cover']}\n"
                                     f"**原视频标题**: {video['old_title']}\n"
                                 )
+                                AliyunLogger.logging(channel_id, name, url, v_id, "视频下载失败", "3002", log_data)
                                 Feishu.finish_bot(text,
                                                   "https://open.feishu.cn/open-apis/bot/v2/hook/493b3d4c-5fae-4a9d-980b-1dd86636524e",
                                                   "【 视频下载失败,跳过该视频 】")
@@ -408,6 +408,7 @@ class VideoProcessor:
                         time.sleep(0.5)
                         Feishu.update_values("ILb4sa0LahddRktnRipcu2vQnLb", sheet, "A2:Z2", values)
             except Exception as e:
+                AliyunLogger.logging(channel_id, name, url, video["video_id"], "改造失败", "3001", log_data)
                 Common.logger(mark).error(f"{name}的{task_mark}任务处理失败:{e}")
                 continue
 
@@ -536,11 +537,11 @@ class VideoProcessor:
                     pw_srt = TTS.getSrt(pw_url)
                     Common.logger(mark).info(f"{name}的{task_mark}下的视频{url},获取AI片尾srt成功")
                 else:
-                    # Feishu.bot('zhangyong', 'TTS获取失败提示', f'无法获取到片尾音频,及时更换token', "张勇")
                     Common.logger(mark).info(f"{name}的{task_mark}下的视频{url},获取AI片尾失败")
                     return None
             else:
                 Common.logger(mark).info(f"{name}的{task_mark}下的视频{url},获取AI片尾失败")
+
                 return None
         else:
             if ',' in video_ending:
@@ -628,6 +629,8 @@ class VideoProcessor:
                 return code
         except Exception as e:
             Common.logger(mark).error(f"{name}的{task_mark}上传视频和封面到OSS,并更新数据库失败:{e}\n")
+            AliyunLogger.logging(channel_id, name, url, video["video_id"], "改造失败-上传视频和封面到OSS", "3001")
+
             return
 
 
@@ -641,13 +644,12 @@ class VideoProcessor:
         feishu_id = data["feishu_id"]
         feishu_sheet = data["feishu_sheet"]
         cookie_sheet = data["cookie_sheet"]
-
+        data = get_data(mark, feishu_id, feishu_sheet)
+        if not data:
+            Common.logger("redis").error(f"{mark}任务开始新的一轮\n")
+            return
+        task = json.loads(data)
         try:
-            data = get_data(mark, feishu_id, feishu_sheet)
-            if not data:
-                Common.logger("redis").error(f"{mark}任务开始新的一轮\n")
-                return
-            task = json.loads(data)
             if mark == 'dy-pl-gjc' and task['channel_id'] == '抖音搜索':
                 mark_count = 'dyss-count'
                 count = get_first_value_with_prefix(mark_count)
@@ -681,7 +683,7 @@ class VideoProcessor:
             VideoProcessor.process_task(task, mark, name, feishu_id, cookie_sheet)
             return mark
         except Exception as e:
-            Common.logger(mark).error(f"任务处理失败: {e}")
+            AliyunLogger.logging((task["channel_id"]), name, task["channel_url"],'', "用户抓取异常", "2005")
             return mark