Browse Source

渠道增加规则

zhangyong 10 tháng trước cách đây
mục cha
commit
1e6a4b519c
3 tập tin đã thay đổi với 21 bổ sung0 xóa
  1. 9 0
      data_channel/douyin.py
  2. 4 0
      data_channel/kuaishou.py
  3. 8 0
      data_channel/shipinhao.py

+ 9 - 0
data_channel/douyin.py

@@ -67,6 +67,15 @@ class DY:
                         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'))  # 转发
+                        if digg_count < 200:
+                            continue
+                        video_percent = '%.2f' % (share_count / digg_count)
+                        special = float(0.2)
+                        if float(video_percent) < special:
+                            continue
                         duration = dataHelp.video_duration(video_url)
                         if int(duration) >= 45:
                             cover_url = data[i].get('video').get('cover').get('url_list')[0]  # 视频封面

+ 4 - 0
data_channel/kuaishou.py

@@ -74,6 +74,10 @@ class KS:
                 if status:
                     cover_url = feeds[i].get('photo', {}).get('coverUrl', "")
                     video_url = feeds[i].get('photo', {}).get('photoUrl', "")
+                    # viewCount = int(feeds[i].get('photo', {}).get('viewCount', 0))
+                    realLikeCount = int(feeds[i].get('photo', {}).get('realLikeCount', 0))
+                    if realLikeCount < 1000:
+                        continue
                     duration = dataHelp.video_duration(video_url)
                     if int(duration) >= 45:
                         all_data = {"video_id": video_id, "cover": cover_url, "video_url": video_url}

+ 8 - 0
data_channel/shipinhao.py

@@ -96,6 +96,14 @@ class SPH:
                             time.sleep(random.randint(0, 1))
                             video_obj = response.json()
                             video_url = video_obj.get('DownloadAddress')
+                            share_cnt = int(obj['forward_count'])  # 分享
+                            like_cnt = int(obj['like_count'])  # 点赞
+                            if like_cnt < 200:
+                                continue
+                            video_percent = '%.2f' % (share_cnt / like_cnt)
+                            special = float(0.2)
+                            if float(video_percent) < special:
+                                continue
                             duration = dataHelp.video_duration(video_url)
                             if int(duration) >= 45:
                                 cover = video_obj.get('thumb_url')