Browse Source

update filter_video_viewed

liqian 2 years ago
parent
commit
4e5f3446db
2 changed files with 12 additions and 9 deletions
  1. 7 0
      config.py
  2. 5 9
      utils.py

+ 7 - 0
config.py

@@ -672,6 +672,13 @@ class BaseConfig(object):
         APP_TYPE['LOVE_LIVE'],  # 票圈视频
         APP_TYPE['APP'],  # 票圈视频APP
     ]
+    # 调用后端接口过滤参数配置 1-已观看 2-视频状态 3-是否进入老年人社区 4-话题状态 5-推荐状态 6-白名单过滤 7-涉政视频过滤
+    FILTER_VIEWED_TYPES_CONFIG = {
+        APP_TYPE['VLOG']: (1, 6,),  # vlog
+        APP_TYPE['LOVE_LIVE']: (1, 6,),  # 票圈视频
+        APP_TYPE['APP']: (1,),  # 票圈视频APP
+        'other': (1, 6, 7,),  # 其他
+    }
 
     # 免广告用户组列表
     NO_AD_MID_GROUP_LIST = {

+ 5 - 9
utils.py

@@ -430,20 +430,16 @@ class FilterVideos(object):
         1-已观看 2-视频状态 3-是否进入老年人社区 4-话题状态 5-推荐状态 6-白名单过滤 7-涉政视频过滤
         :return: filtered_videos
         """
-        # 调用http接口
-        if self.app_type == config_.APP_TYPE['APP']:
-            # app不进行白名单过滤
-            types = (1, )
-        # 涉政视频过滤
-        if self.app_type not in config_.POLITICAL_RECOMMEND_APP_TYPE_LIST:
-            # 增加涉政过滤标识:7
-            types = list(types)
-            types.append(7)
+        # 获取对应端的过滤参数types
+        types = config_.FILTER_VIEWED_TYPES_CONFIG.get(self.app_type, None)
+        if types is None:
+            types = config_.FILTER_VIEWED_TYPES_CONFIG.get('other')
         request_data = {"appType": self.app_type,
                         "mid": self.mid,
                         "uid": self.uid,
                         "types": list(types),
                         "videoIds": video_ids}
+        # 调用http接口
         result = request_post(request_url=config_.VIDEO_FILTER_URL, request_data=request_data, timeout=(0.1, 1))
 
         if result is None: