liqian 3 years ago
parent
commit
5ca04790a8
1 changed files with 6 additions and 0 deletions
  1. 6 0
      top_video_list.py

+ 6 - 0
top_video_list.py

@@ -17,7 +17,12 @@ def get_top_video_list():
         if result['code'] != 0:
         if result['code'] != 0:
             log_.info('获取置顶视频失败!')
             log_.info('获取置顶视频失败!')
             return
             return
+
         data = result['data']
         data = result['data']
+        if len(data) == 0:
+            log_.info('无置顶视频!')
+            return
+
         # 视频状态过滤
         # 视频状态过滤
         video_ids = [item['videoId'] for item in data]
         video_ids = [item['videoId'] for item in data]
         log_.info('video_ids = {}'.format(video_ids))
         log_.info('video_ids = {}'.format(video_ids))
@@ -29,6 +34,7 @@ def get_top_video_list():
         redis_helper = RedisHelper()
         redis_helper = RedisHelper()
         redis_helper.set_data_to_redis(key_name=config_.TOP_VIDEO_LIST_KEY_NAME, value=str(value), expire_time=5*60)
         redis_helper.set_data_to_redis(key_name=config_.TOP_VIDEO_LIST_KEY_NAME, value=str(value), expire_time=5*60)
         log_.info('置顶视频更新成功!')
         log_.info('置顶视频更新成功!')
+
     except Exception as e:
     except Exception as e:
         log_.error('置顶视频更新失败!')
         log_.error('置顶视频更新失败!')
         log_.error(traceback.format_exc())
         log_.error(traceback.format_exc())