浏览代码

抖音优化

zhangyong 1 年之前
父节点
当前提交
7d83a7b000
共有 1 个文件被更改,包括 13 次插入12 次删除
  1. 13 12
      douyin/douyin_author/douyin_author_scheduling_new.py

+ 13 - 12
douyin/douyin_author/douyin_author_scheduling_new.py

@@ -168,18 +168,19 @@ class DouyinauthorScheduling:
                         comment_count = int(data[i].get('statistics').get('comment_count'))  # 评论
                         # collect_count = data[i].get('statistics').get('collect_count')  # 收藏
                         share_count = int(data[i].get('statistics').get('share_count'))  # 转发
-                        video_percent = '%.2f' % (share_count / digg_count)
-                        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"不符合条件:分享/点赞-{video_percent},点赞量-{digg_count}\n"
-                            )
-                            continue
+                        if share_count != 0:
+                            video_percent = '%.2f' % (share_count / digg_count)
+                            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"不符合条件:分享/点赞-{video_percent},点赞量-{digg_count}\n"
+                                )
+                                continue
                         video_dict = {'video_title': video_title,
                                       'video_id': video_id,
                                       'play_cnt': 0,