| 
														
															@@ -5,7 +5,7 @@ import time 
														 | 
													
												
											
												
													
														| 
														 | 
														
															 import requests 
														 | 
														
														 | 
														
															 import requests 
														 | 
													
												
											
												
													
														| 
														 | 
														
															 import urllib3 
														 | 
														
														 | 
														
															 import urllib3 
														 | 
													
												
											
												
													
														| 
														 | 
														
															 from requests.adapters import HTTPAdapter 
														 | 
														
														 | 
														
															 from requests.adapters import HTTPAdapter 
														 | 
													
												
											
												
													
														| 
														 | 
														
															-from common import Material, Common, Feishu 
														 | 
														
														 | 
														
															 
														 | 
													
												
											
												
													
														| 
														 | 
														
															 
														 | 
														
														 | 
														
															+from common import Material, Common, Feishu, AliyunLogger 
														 | 
													
												
											
												
													
														| 
														 | 
														
															 from common.sql_help import sqlCollect 
														 | 
														
														 | 
														
															 from common.sql_help import sqlCollect 
														 | 
													
												
											
												
													
														| 
														 | 
														
															 from data_channel.data_help import dataHelp 
														 | 
														
														 | 
														
															 from data_channel.data_help import dataHelp 
														 | 
													
												
											
												
													
														| 
														 | 
														
															 from data_channel.douyin_help import DouYinHelper 
														 | 
														
														 | 
														
															 from data_channel.douyin_help import DouYinHelper 
														 | 
													
												
											
										
											
												
													
														 | 
														
															@@ -55,7 +55,7 @@ class DY: 
														 | 
													
												
											
												
													
														| 
														 | 
														
															             data = obj.get('aweme_list', []) 
														 | 
														
														 | 
														
															             data = obj.get('aweme_list', []) 
														 | 
													
												
											
												
													
														| 
														 | 
														
															             if data == [] and len(data) == 0: 
														 | 
														
														 | 
														
															             if data == [] and len(data) == 0: 
														 | 
													
												
											
												
													
														| 
														 | 
														
															                 if name == '抖音品类账号' or name == '抖音品类账号-1': 
														 | 
														
														 | 
														
															                 if name == '抖音品类账号' or name == '抖音品类账号-1': 
														 | 
													
												
											
												
													
														| 
														 | 
														
															-                    Feishu.bot("wangxueke", '机器自动改造消息通知', f'抖音-{name}cookie过期,请及时更换', 'wangxueke') 
														 | 
														
														 | 
														
															 
														 | 
													
												
											
												
													
														| 
														 | 
														
															 
														 | 
														
														 | 
														
															+                    Feishu.bot("liukunyu", '机器自动改造消息通知', f'抖音-{name}cookie过期,请及时更换', 'liukunyu') 
														 | 
													
												
											
												
													
														| 
														 | 
														
															                 else: 
														 | 
														
														 | 
														
															                 else: 
														 | 
													
												
											
												
													
														| 
														 | 
														
															                     Feishu.bot(mark, '机器自动改造消息通知', f'抖音-{name}cookie过期,请及时更换', name) 
														 | 
														
														 | 
														
															                     Feishu.bot(mark, '机器自动改造消息通知', f'抖音-{name}cookie过期,请及时更换', name) 
														 | 
													
												
											
												
													
														| 
														 | 
														
															                 return list 
														 | 
														
														 | 
														
															                 return list 
														 | 
													
												
											
										
											
												
													
														 | 
														
															@@ -66,41 +66,51 @@ class DY: 
														 | 
													
												
											
												
													
														| 
														 | 
														
															                     # is_top = data[i].get('is_top')  # 是否置顶 
														 | 
														
														 | 
														
															                     # is_top = data[i].get('is_top')  # 是否置顶 
														 | 
													
												
											
												
													
														| 
														 | 
														
															                     video_id = data[i].get('aweme_id')  # 文章id 
														 | 
														
														 | 
														
															                     video_id = data[i].get('aweme_id')  # 文章id 
														 | 
													
												
											
												
													
														| 
														 | 
														
															                     status = sqlCollect.is_used(task_mark, video_id, mark, channel_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: 
														 | 
														
														 | 
														
															                     if status: 
														 | 
													
												
											
												
													
														| 
														 | 
														
															-                        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", "") 
														 | 
														
														 | 
														
															 
														 | 
													
												
											
												
													
														| 
														 | 
														
															 
														 | 
														
														 | 
														
															+                        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) 
														 | 
													
												
											
												
													
														| 
														 | 
														
															 
														 | 
														
														 | 
														
															+                        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( 
														 | 
														
														 | 
														
															                         Common.logger("dy").info( 
														 | 
													
												
											
												
													
														| 
														 | 
														
															-                            f"扫描:{task_mark},用户主页id:{url_id},视频id{video_id} ,分享:{share_count},点赞{digg_count}") 
														 | 
														
														 | 
														
															 
														 | 
													
												
											
												
													
														| 
														 | 
														
															-                        if share_count < 200: 
														 | 
														
														 | 
														
															 
														 | 
													
												
											
												
													
														| 
														 | 
														
															-                            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: 
														 | 
														
														 | 
														
															 
														 | 
													
												
											
												
													
														| 
														 | 
														
															-                            Common.logger("dy").info( 
														 | 
														
														 | 
														
															 
														 | 
													
												
											
												
													
														| 
														 | 
														
															-                                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} ") 
														 | 
														
														 | 
														
															 
														 | 
													
												
											
												
													
														| 
														 | 
														
															-                            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} 
														 | 
														
														 | 
														
															 
														 | 
													
												
											
												
													
														| 
														 | 
														
															-                        list.append(all_data) 
														 | 
														
														 | 
														
															 
														 | 
													
												
											
												
													
														| 
														 | 
														
															-                        if len(list) == int(number): 
														 | 
														
														 | 
														
															 
														 | 
													
												
											
												
													
														| 
														 | 
														
															-                            Common.logger(mark).info(f"获取抖音视频总数:{len(list)}\n") 
														 | 
														
														 | 
														
															 
														 | 
													
												
											
												
													
														| 
														 | 
														
															-                            return list 
														 | 
														
														 | 
														
															 
														 | 
													
												
											
												
													
														| 
														 | 
														
															 
														 | 
														
														 | 
														
															+                            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 
														 | 
														
														 | 
														
															         return list 
														 |