|  | @@ -221,7 +221,8 @@ class FilterVideos(object):
 | 
	
		
			
				|  |  |                   expansion_factor=None,
 | 
	
		
			
				|  |  |                   risk_filter_flag=None,
 | 
	
		
			
				|  |  |                   app_region_filtered=None,
 | 
	
		
			
				|  |  | -                 videos_with_risk=None):
 | 
	
		
			
				|  |  | +                 videos_with_risk=None,
 | 
	
		
			
				|  |  | +                 force_truncation=None):
 | 
	
		
			
				|  |  |          """
 | 
	
		
			
				|  |  |          初始化
 | 
	
		
			
				|  |  |          :param request_id: request_id
 | 
	
	
		
			
				|  | @@ -239,6 +240,7 @@ class FilterVideos(object):
 | 
	
		
			
				|  |  |          self.risk_filter_flag = risk_filter_flag
 | 
	
		
			
				|  |  |          self.app_region_filtered = app_region_filtered
 | 
	
		
			
				|  |  |          self.videos_with_risk = videos_with_risk
 | 
	
		
			
				|  |  | +        self.force_truncation = force_truncation
 | 
	
		
			
				|  |  |  
 | 
	
		
			
				|  |  |      def filter_video_status_h(self, video_ids, rule_key, data_key, ab_code, province_code, key_flag=''):
 | 
	
		
			
				|  |  |          """召回小时级更新的视频状态过滤"""
 | 
	
	
		
			
				|  | @@ -858,7 +860,7 @@ class FilterVideos(object):
 | 
	
		
			
				|  |  |          # 0 用一个开关控制,是否过滤生效。 便于回滚功能。
 | 
	
		
			
				|  |  |          risk_filter_flag = self.risk_filter_flag
 | 
	
		
			
				|  |  |          if not risk_filter_flag:
 | 
	
		
			
				|  |  | -            return video_ids[0: min(20, len(video_ids))]
 | 
	
		
			
				|  |  | +            return self.truncation(video_ids)
 | 
	
		
			
				|  |  |          # 1 判断是否过滤,不展示的app+区域列表,-1必须过滤
 | 
	
		
			
				|  |  |          app_region_filtered = self.app_region_filtered
 | 
	
		
			
				|  |  |          if app_type in app_region_filtered.keys():
 | 
	
	
		
			
				|  | @@ -867,10 +869,8 @@ class FilterVideos(object):
 | 
	
		
			
				|  |  |                  if_filtered = True
 | 
	
		
			
				|  |  |          else:
 | 
	
		
			
				|  |  |              if_filtered = True
 | 
	
		
			
				|  |  | -        if region_code == -1:
 | 
	
		
			
				|  |  | -            if_filtered = True
 | 
	
		
			
				|  |  |          if not if_filtered:
 | 
	
		
			
				|  |  | -            return video_ids[0: min(20, len(video_ids))]
 | 
	
		
			
				|  |  | +            return self.truncation(video_ids)
 | 
	
		
			
				|  |  |          # 2 确认过滤,获取风险video列表param_update_risk_videos
 | 
	
		
			
				|  |  |          videos_with_risk = self.videos_with_risk
 | 
	
		
			
				|  |  |          # 3 过滤 返回结果
 | 
	
	
		
			
				|  | @@ -884,7 +884,13 @@ class FilterVideos(object):
 | 
	
		
			
				|  |  |          # print(video_ids_new)
 | 
	
		
			
				|  |  |          # print(len(video_ids))
 | 
	
		
			
				|  |  |          # print(len(video_ids_new))
 | 
	
		
			
				|  |  | -        return video_ids_new[0: min(20, len(video_ids_new))]
 | 
	
		
			
				|  |  | +        return self.truncation(video_ids_new)
 | 
	
		
			
				|  |  | +
 | 
	
		
			
				|  |  | +    def truncation(self, video_ids):
 | 
	
		
			
				|  |  | +        if self.force_truncation is None:
 | 
	
		
			
				|  |  | +            return video_ids
 | 
	
		
			
				|  |  | +        else:
 | 
	
		
			
				|  |  | +            return video_ids[:min(self.force_truncation, len(video_ids))]
 | 
	
		
			
				|  |  |  
 | 
	
		
			
				|  |  |  if __name__ == '__main__':
 | 
	
		
			
				|  |  |      user = [
 |