Browse Source

抖、快、视频号修改规则

zhangyong 10 months ago
parent
commit
db67d4d9f3

+ 14 - 17
douyin/douyin_author/douyin_author_scheduling_new.py

@@ -63,19 +63,16 @@ class DouyinauthorScheduling:
             if flag == "V1":
             if flag == "V1":
                 special = 0.01
                 special = 0.01
                 rule_dict = {
                 rule_dict = {
-                    "like_cnt": {"min": 10000, "max": 0},
                     'period': {"min": 15, "max": 0},
                     'period': {"min": 15, "max": 0},
                 }
                 }
             elif flag == "V2":
             elif flag == "V2":
                 special = 0.01
                 special = 0.01
                 rule_dict = {
                 rule_dict = {
-                    "like_cnt": {"min": 2000, "max": 0},
                     'period': {"min": 15, "max": 0},
                     'period': {"min": 15, "max": 0},
                 }
                 }
             elif flag == "V3":
             elif flag == "V3":
                 special = 0.01
                 special = 0.01
                 rule_dict = {
                 rule_dict = {
-                    "like_cnt": {"min": 100, "max": 0},
                     'period': {"min": 15, "max": 0},
                     'period': {"min": 15, "max": 0},
                 }
                 }
             cookie = cls.get_cookie(log_type, crawler, env)["cookie"]
             cookie = cls.get_cookie(log_type, crawler, env)["cookie"]
@@ -176,20 +173,20 @@ class DouyinauthorScheduling:
                         comment_count = int(data[i].get('statistics').get('comment_count'))  # 评论
                         comment_count = int(data[i].get('statistics').get('comment_count'))  # 评论
                         # collect_count = data[i].get('statistics').get('collect_count')  # 收藏
                         # collect_count = data[i].get('statistics').get('collect_count')  # 收藏
                         share_count = int(data[i].get('statistics').get('share_count'))  # 转发
                         share_count = int(data[i].get('statistics').get('share_count'))  # 转发
-                        if special != 0:
-                            if share_count != 0:
-                                video_percent = '%.2f' % (share_count / digg_count)
-                                special = float(special)
-                                if float(video_percent) < special:
-                                    Common.logger(log_type, crawler).info(f"不符合条件:分享/点赞-{video_percent}\n")
-                                    AliyunLogger.logging(
-                                        code="2004",
-                                        platform=crawler,
-                                        mode=log_type,
-                                        env=env,
-                                        message=f"不符合条件:分享/点赞-{video_percent},点赞量-{digg_count}\n"
-                                    )
-                                    continue
+                        # if special != 0:
+                        #     if share_count != 0:
+                        #         video_percent = '%.2f' % (share_count / digg_count)
+                        #         special = float(special)
+                        #         if float(video_percent) < special:
+                        #             Common.logger(log_type, crawler).info(f"不符合条件:分享/点赞-{video_percent}\n")
+                        #             AliyunLogger.logging(
+                        #                 code="2004",
+                        #                 platform=crawler,
+                        #                 mode=log_type,
+                        #                 env=env,
+                        #                 message=f"不符合条件:分享/点赞-{video_percent},点赞量-{digg_count}\n"
+                        #             )
+                        #             continue
                         video_dict = {'video_title': video_title,
                         video_dict = {'video_title': video_title,
                                       'video_id': video_id,
                                       'video_id': video_id,
                                       'play_cnt': 0,
                                       'play_cnt': 0,

+ 1 - 4
kuaishou/kuaishou_author/kuaishou_author_scheduling_new.py

@@ -99,19 +99,16 @@ class KuaishouauthorScheduling:
                 flag = user_dict["link"].split("_")[0]
                 flag = user_dict["link"].split("_")[0]
                 if flag == "V1":
                 if flag == "V1":
                     rule_dict = {
                     rule_dict = {
-                        "play_cnt": {"min": 10000, "max": 0},
                         'period': {"min": 15, "max": 0},
                         'period': {"min": 15, "max": 0},
                     }
                     }
                     special = 0.01
                     special = 0.01
                 elif flag == "V2":
                 elif flag == "V2":
                     rule_dict = {
                     rule_dict = {
-                        "play_cnt": {"min": 2000, "max": 0},
                         'period': {"min": 15, "max": 0},
                         'period': {"min": 15, "max": 0},
                     }
                     }
                     special = 0.01
                     special = 0.01
                 elif flag == "V3":
                 elif flag == "V3":
                     rule_dict = {
                     rule_dict = {
-                        "play_cnt": {"min": 100, "max": 0},
                         'period': {"min": 15, "max": 0},
                         'period': {"min": 15, "max": 0},
                     }
                     }
                     special = 0.01
                     special = 0.01
@@ -247,7 +244,7 @@ class KuaishouauthorScheduling:
 
 
                     viewCount = int(feeds[i].get('photo', {}).get('viewCount', 0))
                     viewCount = int(feeds[i].get('photo', {}).get('viewCount', 0))
                     realLikeCount = int(feeds[i].get('photo', {}).get('realLikeCount', 0))
                     realLikeCount = int(feeds[i].get('photo', {}).get('realLikeCount', 0))
-                    video_percent = '%.2f' % (realLikeCount / viewCount)
+                    # video_percent = '%.2f' % (realLikeCount / viewCount)
                     # if special != 0:
                     # if special != 0:
                     #     special = float(special)
                     #     special = float(special)
                     #     if float(video_percent) < special:
                     #     if float(video_percent) < special:

+ 4 - 4
kuaishou/kuaishou_main/run_ks_author_dev.py

@@ -10,14 +10,14 @@ from kuaishou.kuaishou_author.kuaishou_author_scheduling_new import Kuaishouauth
 
 
 def kuaishou_recommend_main(log_type, crawler, env):
 def kuaishou_recommend_main(log_type, crawler, env):
     Common.logger(log_type, crawler).info("开始抓取:快手账号\n")
     Common.logger(log_type, crawler).info("开始抓取:快手账号\n")
-    Common.logging(log_type, crawler, env, "开始抓取:快手账号\n")
+    # Common.logging(log_type, crawler, env, "开始抓取:快手账号\n")
     KuaishouauthorScheduling.get_author_videos(log_type=log_type,
     KuaishouauthorScheduling.get_author_videos(log_type=log_type,
                                                crawler=crawler,
                                                crawler=crawler,
                                                rule_dict={"videos_cnt": {"min": 5, "max": 0},
                                                rule_dict={"videos_cnt": {"min": 5, "max": 0},
                                                           "like_cnt": {"min": 100, "max": 0},
                                                           "like_cnt": {"min": 100, "max": 0},
                                                           "duration": {"min": 30, "max": 0},
                                                           "duration": {"min": 30, "max": 0},
                                                           "period": {"min": 365, "max": 365}},
                                                           "period": {"min": 365, "max": 365}},
-                                               user_list=[{"uid": 6267140, "source": "kuaishou", "link": "V2_https://www.kuaishou.com/profile/3xx43zn5t7m64qa",
+                                               user_list=[{"uid": 6267140, "source": "kuaishou", "link": "V3_https://www.kuaishou.com/profile/3x5is4uxbwyvc7m",
                                                            "nick_name": "买两个橘子",
                                                            "nick_name": "买两个橘子",
                                                            "avatar_url": "http://rescdn.yishihui.com/user/default/avatar/live/1616555578819_u=1922778943,2660693611&fm=26&gp=0.jpg",
                                                            "avatar_url": "http://rescdn.yishihui.com/user/default/avatar/live/1616555578819_u=1922778943,2660693611&fm=26&gp=0.jpg",
                                                            "mode": "author"},
                                                            "mode": "author"},
@@ -28,8 +28,8 @@ def kuaishou_recommend_main(log_type, crawler, env):
                                                env=env)
                                                env=env)
     Common.del_logs(log_type, crawler)
     Common.del_logs(log_type, crawler)
     Common.logger(log_type, crawler).info("抓取一轮结束\n")
     Common.logger(log_type, crawler).info("抓取一轮结束\n")
-    Common.logging(log_type, crawler, env, "抓取一轮结束\n")
+    # Common.logging(log_type, crawler, env, "抓取一轮结束\n")
 
 
 
 
 if __name__ == "__main__":
 if __name__ == "__main__":
-    kuaishou_recommend_main("author", "kuaishou", "dev")
+    kuaishou_recommend_main("author", "kuaishou", "prod")

+ 43 - 43
shipinhao/shipinhao_author/shipinhao_author.py

@@ -242,7 +242,7 @@ class ShiPinHaoAuthor(object):
         else:
         else:
             divisor_cnt = int(share_cnt / fav_count)
             divisor_cnt = int(share_cnt / fav_count)
         # 视频时长小于30秒 返回
         # 视频时长小于30秒 返回
-        if duration < 20:
+        if duration < 15:
             values = [[
             values = [[
                 obj['nickname'],
                 obj['nickname'],
                 publish_time_str,
                 publish_time_str,
@@ -262,48 +262,48 @@ class ShiPinHaoAuthor(object):
             time.sleep(0.5)
             time.sleep(0.5)
             Feishu.update_values(self.platform, 'shipinhao', "Vq7NeH", "A2:Z2", values)
             Feishu.update_values(self.platform, 'shipinhao', "Vq7NeH", "A2:Z2", values)
             return True
             return True
-        # 分享小于1000 返回
-        if share_cnt < 500:
-            values = [[
-                obj['nickname'],
-                publish_time_str,
-                formatted_time,
-                int(obj['fav_count']),
-                int(obj['comment_count']),
-                int(obj['like_count']),
-                int(obj['forward_count']),
-                divisor_cnt,
-                video_obj.get('title').split("\n")[0].split("#")[0],
-                duration,
-                '否',
-                '分享小于500',
-                video_obj.get('DownloadAddress')
-            ]]
-            Feishu.insert_columns(self.platform, 'shipinhao', "Vq7NeH", "ROWS", 1, 2)
-            time.sleep(0.5)
-            Feishu.update_values(self.platform, 'shipinhao', "Vq7NeH", "A2:Z2", values)
-            return True
-        # 分享小于等于99999
-        if share_cnt <= 99999 and divisor_cnt < 1:
-            values = [[
-                obj['nickname'],
-                publish_time_str,
-                formatted_time,
-                int(obj['fav_count']),
-                int(obj['comment_count']),
-                int(obj['like_count']),
-                int(obj['forward_count']),
-                divisor_cnt,
-                video_obj.get('title').split("\n")[0].split("#")[0],
-                duration,
-                '否',
-                f'分享小于100000,分享/大拇指:{divisor_cnt}',
-                video_obj.get('DownloadAddress')
-            ]]
-            Feishu.insert_columns(self.platform, 'shipinhao', "Vq7NeH", "ROWS", 1, 2)
-            time.sleep(0.5)
-            Feishu.update_values(self.platform, 'shipinhao', "Vq7NeH", "A2:Z2", values)
-            return True
+        # # 分享小于1000 返回
+        # if share_cnt < 500:
+        #     values = [[
+        #         obj['nickname'],
+        #         publish_time_str,
+        #         formatted_time,
+        #         int(obj['fav_count']),
+        #         int(obj['comment_count']),
+        #         int(obj['like_count']),
+        #         int(obj['forward_count']),
+        #         divisor_cnt,
+        #         video_obj.get('title').split("\n")[0].split("#")[0],
+        #         duration,
+        #         '否',
+        #         '分享小于500',
+        #         video_obj.get('DownloadAddress')
+        #     ]]
+        #     Feishu.insert_columns(self.platform, 'shipinhao', "Vq7NeH", "ROWS", 1, 2)
+        #     time.sleep(0.5)
+        #     Feishu.update_values(self.platform, 'shipinhao', "Vq7NeH", "A2:Z2", values)
+        #     return True
+        # # 分享小于等于99999
+        # if share_cnt <= 99999 and divisor_cnt < 1:
+        #     values = [[
+        #         obj['nickname'],
+        #         publish_time_str,
+        #         formatted_time,
+        #         int(obj['fav_count']),
+        #         int(obj['comment_count']),
+        #         int(obj['like_count']),
+        #         int(obj['forward_count']),
+        #         divisor_cnt,
+        #         video_obj.get('title').split("\n")[0].split("#")[0],
+        #         duration,
+        #         '否',
+        #         f'分享小于100000,分享/大拇指:{divisor_cnt}',
+        #         video_obj.get('DownloadAddress')
+        #     ]]
+        #     Feishu.insert_columns(self.platform, 'shipinhao', "Vq7NeH", "ROWS", 1, 2)
+        #     time.sleep(0.5)
+        #     Feishu.update_values(self.platform, 'shipinhao', "Vq7NeH", "A2:Z2", values)
+        #     return True
         pipeline = PiaoQuanPipeline(
         pipeline = PiaoQuanPipeline(
             platform=self.platform,
             platform=self.platform,
             mode=self.mode,
             mode=self.mode,