Browse Source

快手优化

zhangyong 1 year ago
parent
commit
fde49c2618
1 changed files with 12 additions and 11 deletions
  1. 12 11
      kuaishou/kuaishou_author/kuaishou_author_scheduling_new.py

+ 12 - 11
kuaishou/kuaishou_author/kuaishou_author_scheduling_new.py

@@ -235,17 +235,18 @@ class KuaishouauthorScheduling:
                     viewCount = int(feeds[i].get('photo', {}).get('viewCount', 0))
                     realLikeCount = int(feeds[i].get('photo', {}).get('realLikeCount', 0))
                     video_percent = '%.2f' % (realLikeCount / viewCount)
-                    special = float(rule_dict.get("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"点赞量:{realLikeCount}\n"
-                        )
-                        continue
+                    if "special" in rule_dict:
+                        special = float(rule_dict.get("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"点赞量:{realLikeCount}\n"
+                            )
+                            continue
                     video_dict = {'video_title': video_title,
                                   'video_id': video_id,
                                   'play_cnt': int(feeds[i].get('photo', {}).get('viewCount', 0)),