|
@@ -45,68 +45,85 @@ class XiaoniangaoHourScheduling:
|
|
:param rule_dict: 规则信息,字典格式
|
|
:param rule_dict: 规则信息,字典格式
|
|
:return: 满足规则,返回 True;反之,返回 False
|
|
:return: 满足规则,返回 True;反之,返回 False
|
|
"""
|
|
"""
|
|
- # rule_period_max = rule_dict.get('period', {}).get('max', 100000000)
|
|
|
|
- # rule_fans_min = rule_dict.get('fans', {}).get('min', 0)
|
|
|
|
- # rule_fans_max = rule_dict.get('fans', {}).get('max', 100000000)
|
|
|
|
- # rule_videos_min = rule_dict.get('videos', {}).get('min', 0)
|
|
|
|
- # rule_videos_max = rule_dict.get('videos', {}).get('max', 100000000)
|
|
|
|
- rule_duration_min = rule_dict.get('duration', {}).get('min', 0)
|
|
|
|
- rule_duration_max = rule_dict.get('duration', {}).get('max', 100000000)
|
|
|
|
- if rule_duration_max == 0:
|
|
|
|
- rule_duration_max = 100000000
|
|
|
|
rule_playCnt_min = rule_dict.get('playCnt', {}).get('min', 0)
|
|
rule_playCnt_min = rule_dict.get('playCnt', {}).get('min', 0)
|
|
rule_playCnt_max = rule_dict.get('playCnt', {}).get('max', 100000000)
|
|
rule_playCnt_max = rule_dict.get('playCnt', {}).get('max', 100000000)
|
|
if rule_playCnt_max == 0:
|
|
if rule_playCnt_max == 0:
|
|
rule_playCnt_max = 100000000
|
|
rule_playCnt_max = 100000000
|
|
|
|
+
|
|
|
|
+ rule_duration_min = rule_dict.get('duration', {}).get('min', 0)
|
|
|
|
+ rule_duration_max = rule_dict.get('duration', {}).get('max', 100000000)
|
|
|
|
+ if rule_duration_max == 0:
|
|
|
|
+ rule_duration_max = 100000000
|
|
|
|
+
|
|
rule_period_min = rule_dict.get('period', {}).get('min', 0)
|
|
rule_period_min = rule_dict.get('period', {}).get('min', 0)
|
|
|
|
+ # rule_period_max = rule_dict.get('period', {}).get('max', 100000000)
|
|
|
|
+ # if rule_period_max == 0:
|
|
|
|
+ # rule_period_max = 100000000
|
|
|
|
+ #
|
|
|
|
+ # rule_fans_min = rule_dict.get('fans', {}).get('min', 0)
|
|
|
|
+ # rule_fans_max = rule_dict.get('fans', {}).get('max', 100000000)
|
|
|
|
+ # if rule_fans_max == 0:
|
|
|
|
+ # rule_fans_max = 100000000
|
|
|
|
+ #
|
|
|
|
+ # rule_videos_min = rule_dict.get('videos', {}).get('min', 0)
|
|
|
|
+ # rule_videos_max = rule_dict.get('videos', {}).get('max', 100000000)
|
|
|
|
+ # if rule_videos_max == 0:
|
|
|
|
+ # rule_videos_max = 100000000
|
|
|
|
+
|
|
rule_like_min = rule_dict.get('like', {}).get('min', 0)
|
|
rule_like_min = rule_dict.get('like', {}).get('min', 0)
|
|
rule_like_max = rule_dict.get('like', {}).get('max', 100000000)
|
|
rule_like_max = rule_dict.get('like', {}).get('max', 100000000)
|
|
if rule_like_max == 0:
|
|
if rule_like_max == 0:
|
|
rule_like_max = 100000000
|
|
rule_like_max = 100000000
|
|
|
|
+
|
|
rule_videoWidth_min = rule_dict.get('videoWidth', {}).get('min', 0)
|
|
rule_videoWidth_min = rule_dict.get('videoWidth', {}).get('min', 0)
|
|
rule_videoWidth_max = rule_dict.get('videoWidth', {}).get('max', 100000000)
|
|
rule_videoWidth_max = rule_dict.get('videoWidth', {}).get('max', 100000000)
|
|
if rule_videoWidth_max == 0:
|
|
if rule_videoWidth_max == 0:
|
|
rule_videoWidth_max = 100000000
|
|
rule_videoWidth_max = 100000000
|
|
- rule_videoHeight_min = rule_dict.get('videoWidth', {}).get('min', 0)
|
|
|
|
- rule_videoHeight_max = rule_dict.get('videoWidth', {}).get('max', 100000000)
|
|
|
|
|
|
+
|
|
|
|
+ rule_videoHeight_min = rule_dict.get('videoHeight', {}).get('min', 0)
|
|
|
|
+ rule_videoHeight_max = rule_dict.get('videoHeight', {}).get('max', 100000000)
|
|
if rule_videoHeight_max == 0:
|
|
if rule_videoHeight_max == 0:
|
|
rule_videoHeight_max = 100000000
|
|
rule_videoHeight_max = 100000000
|
|
- Common.logger(log_type, crawler).info(f'rule_duration_max:{rule_duration_max} >= duration:{int(float(video_dict["duration"]))} >= rule_duration_min:{int(rule_duration_min)}')
|
|
|
|
- Common.logger(log_type, crawler).info(f'rule_playCnt_max:{int(rule_playCnt_max)} >= play_cnt:{int(video_dict["play_cnt"])} >= rule_playCnt_min:{int(rule_playCnt_min)}')
|
|
|
|
- Common.logger(log_type, crawler).info(f'now:{int(time.time())} - publish_time_stamp:{int(video_dict["publish_time_stamp"])} <= {3600 * 24 * int(rule_period_min)}')
|
|
|
|
- Common.logger(log_type, crawler).info(f'rule_like_max:{int(rule_like_max)} >= like_cnt:{int(video_dict["like_cnt"])} >= rule_like_min:{int(rule_like_min)}')
|
|
|
|
- Common.logger(log_type, crawler).info(f'rule_videoWidth_max:{int(rule_videoWidth_max)} >= video_width:{int(video_dict["video_width"])} >= rule_videoWidth_min:{int(rule_videoWidth_min)}')
|
|
|
|
- Common.logger(log_type, crawler).info(f'rule_videoHeight_max:{int(rule_videoHeight_max)} >= video_height:{int(video_dict["video_height"])} >= rule_videoHeight_min:{int(rule_videoHeight_min)}')
|
|
|
|
|
|
+
|
|
|
|
+ rule_shareCnt_min = rule_dict.get('shareCnt', {}).get('min', 0)
|
|
|
|
+ rule_shareCnt_max = rule_dict.get('shareCnt', {}).get('max', 100000000)
|
|
|
|
+ if rule_shareCnt_max == 0:
|
|
|
|
+ rule_shareCnt_max = 100000000
|
|
|
|
+
|
|
|
|
+ rule_commentCnt_min = rule_dict.get('commentCnt', {}).get('min', 0)
|
|
|
|
+ rule_commentCnt_max = rule_dict.get('commentCnt', {}).get('max', 100000000)
|
|
|
|
+ if rule_commentCnt_max == 0:
|
|
|
|
+ rule_commentCnt_max = 100000000
|
|
|
|
+
|
|
|
|
+ Common.logger(log_type, crawler).info(
|
|
|
|
+ f'rule_duration_max:{rule_duration_max} >= duration:{int(float(video_dict["duration"]))} >= rule_duration_min:{int(rule_duration_min)}')
|
|
|
|
+ Common.logger(log_type, crawler).info(
|
|
|
|
+ f'rule_playCnt_max:{int(rule_playCnt_max)} >= play_cnt:{int(video_dict["play_cnt"])} >= rule_playCnt_min:{int(rule_playCnt_min)}')
|
|
|
|
+ Common.logger(log_type, crawler).info(
|
|
|
|
+ f'now:{int(time.time())} - publish_time_stamp:{int(video_dict["publish_time_stamp"])} <= {3600 * 24 * int(rule_period_min)}')
|
|
|
|
+ Common.logger(log_type, crawler).info(
|
|
|
|
+ f'rule_like_max:{int(rule_like_max)} >= like_cnt:{int(video_dict["like_cnt"])} >= rule_like_min:{int(rule_like_min)}')
|
|
|
|
+ Common.logger(log_type, crawler).info(
|
|
|
|
+ f'rule_commentCnt_max:{int(rule_commentCnt_max)} >= comment_cnt:{int(video_dict["comment_cnt"])} >= rule_commentCnt_min:{int(rule_commentCnt_min)}')
|
|
|
|
+ Common.logger(log_type, crawler).info(
|
|
|
|
+ f'rule_shareCnt_max:{int(rule_shareCnt_max)} >= share_cnt:{int(video_dict["share_cnt"])} >= rule_shareCnt_min:{int(rule_shareCnt_min)}')
|
|
|
|
+ Common.logger(log_type, crawler).info(
|
|
|
|
+ f'rule_videoWidth_max:{int(rule_videoWidth_max)} >= video_width:{int(video_dict["video_width"])} >= rule_videoWidth_min:{int(rule_videoWidth_min)}')
|
|
|
|
+ Common.logger(log_type, crawler).info(
|
|
|
|
+ f'rule_videoHeight_max:{int(rule_videoHeight_max)} >= video_height:{int(video_dict["video_height"])} >= rule_videoHeight_min:{int(rule_videoHeight_min)}')
|
|
|
|
+
|
|
if int(rule_duration_max) >= int(float(video_dict["duration"])) >= int(rule_duration_min) \
|
|
if int(rule_duration_max) >= int(float(video_dict["duration"])) >= int(rule_duration_min) \
|
|
and int(rule_playCnt_max) >= int(video_dict['play_cnt']) >= int(rule_playCnt_min) \
|
|
and int(rule_playCnt_max) >= int(video_dict['play_cnt']) >= int(rule_playCnt_min) \
|
|
- and int(time.time()) - int(video_dict["publish_time_stamp"]) <= 3600 * 24 * int(rule_period_min)\
|
|
|
|
- and int(rule_like_max) >= int(video_dict['like_cnt']) >= int(rule_like_min)\
|
|
|
|
- and int(rule_videoWidth_max) >= int(video_dict['video_width']) >= int(rule_videoWidth_min)\
|
|
|
|
|
|
+ and int(time.time()) - int(video_dict["publish_time_stamp"]) <= 3600 * 24 * int(rule_period_min) \
|
|
|
|
+ and int(rule_like_max) >= int(video_dict['like_cnt']) >= int(rule_like_min) \
|
|
|
|
+ and int(rule_commentCnt_max) >= int(video_dict['comment_cnt']) >= int(rule_commentCnt_min) \
|
|
|
|
+ and int(rule_shareCnt_max) >= int(video_dict['share_cnt']) >= int(rule_shareCnt_min) \
|
|
|
|
+ and int(rule_videoWidth_max) >= int(video_dict['video_width']) >= int(rule_videoWidth_min) \
|
|
and int(rule_videoHeight_max) >= int(video_dict['video_height']) >= int(rule_videoHeight_min):
|
|
and int(rule_videoHeight_max) >= int(video_dict['video_height']) >= int(rule_videoHeight_min):
|
|
return True
|
|
return True
|
|
else:
|
|
else:
|
|
return False
|
|
return False
|
|
|
|
|
|
- # if int(rule_duration_max) >= int(float(video_dict["duration"])) >= int(rule_duration_min):
|
|
|
|
- # if int(rule_playCnt_max) >= int(video_dict['play_cnt']) >= 0:
|
|
|
|
- # if int(time.time()) - int(video_dict["publish_time_stamp"]) <= 3600 * 24 * 365:
|
|
|
|
- # if int(rule_like_max) >= int(video_dict['like_cnt']) >= int(rule_like_min):
|
|
|
|
- # if int(rule_videoWidth_max) >= int(video_dict['video_width']) >= int(rule_videoWidth_min):
|
|
|
|
- # if int(rule_videoHeight_max) >= int(video_dict['video_height']) >= int(rule_videoHeight_min):
|
|
|
|
- # return True
|
|
|
|
- # else:
|
|
|
|
- # return False
|
|
|
|
- # else:
|
|
|
|
- # return False
|
|
|
|
- # else:
|
|
|
|
- # return False
|
|
|
|
- # else:
|
|
|
|
- # return False
|
|
|
|
- # else:
|
|
|
|
- # return False
|
|
|
|
- # else:
|
|
|
|
- # return False
|
|
|
|
-
|
|
|
|
@classmethod
|
|
@classmethod
|
|
def repeat_video(cls, log_type, crawler, video_id, env):
|
|
def repeat_video(cls, log_type, crawler, video_id, env):
|
|
sql = f""" select * from crawler_video where platform="小年糕" and out_video_id="{video_id}"; """
|
|
sql = f""" select * from crawler_video where platform="小年糕" and out_video_id="{video_id}"; """
|
|
@@ -412,7 +429,7 @@ class XiaoniangaoHourScheduling:
|
|
|
|
|
|
# 更新小时榜数据
|
|
# 更新小时榜数据
|
|
@classmethod
|
|
@classmethod
|
|
- def update_videoList(cls, log_type, crawler, strategy, oss_endpoint, env):
|
|
|
|
|
|
+ def update_videoList(cls, log_type, crawler, rule_dict, strategy, oss_endpoint, env):
|
|
"""
|
|
"""
|
|
更新小时榜数据
|
|
更新小时榜数据
|
|
"""
|
|
"""
|
|
@@ -440,8 +457,14 @@ class XiaoniangaoHourScheduling:
|
|
update_sql = f""" update crawler_xiaoniangao_hour set ten_play_cnt={ten_play_cnt} WHERE out_video_id="{video_id}"; """
|
|
update_sql = f""" update crawler_xiaoniangao_hour set ten_play_cnt={ten_play_cnt} WHERE out_video_id="{video_id}"; """
|
|
# Common.logger(log_type, crawler).info(f"update_sql:{update_sql}")
|
|
# Common.logger(log_type, crawler).info(f"update_sql:{update_sql}")
|
|
MysqlHelper.update_values(log_type, crawler, update_sql, env)
|
|
MysqlHelper.update_values(log_type, crawler, update_sql, env)
|
|
- cls.download_publish(log_type, crawler, video_info_dict, update_video_info, strategy, oss_endpoint,
|
|
|
|
- env)
|
|
|
|
|
|
+ cls.download_publish(log_type=log_type,
|
|
|
|
+ crawler=crawler,
|
|
|
|
+ video_info_dict=video_info_dict,
|
|
|
|
+ rule_dict=rule_dict,
|
|
|
|
+ update_video_info=update_video_info,
|
|
|
|
+ strategy=strategy,
|
|
|
|
+ oss_endpoint=oss_endpoint,
|
|
|
|
+ env=env)
|
|
elif datetime.datetime.now().hour == 15 and datetime.datetime.now().minute <= 10:
|
|
elif datetime.datetime.now().hour == 15 and datetime.datetime.now().minute <= 10:
|
|
video_info_dict = cls.get_video_info(log_type=log_type,
|
|
video_info_dict = cls.get_video_info(log_type=log_type,
|
|
crawler=crawler,
|
|
crawler=crawler,
|
|
@@ -454,8 +477,14 @@ class XiaoniangaoHourScheduling:
|
|
update_sql = f""" update crawler_xiaoniangao_hour set fifteen_play_cnt={fifteen_play_cnt} WHERE out_video_id="{video_id}"; """
|
|
update_sql = f""" update crawler_xiaoniangao_hour set fifteen_play_cnt={fifteen_play_cnt} WHERE out_video_id="{video_id}"; """
|
|
# Common.logger(log_type, crawler).info(f"update_sql:{update_sql}")
|
|
# Common.logger(log_type, crawler).info(f"update_sql:{update_sql}")
|
|
MysqlHelper.update_values(log_type, crawler, update_sql, env)
|
|
MysqlHelper.update_values(log_type, crawler, update_sql, env)
|
|
- cls.download_publish(log_type, crawler, video_info_dict, update_video_info, strategy, oss_endpoint,
|
|
|
|
- env)
|
|
|
|
|
|
+ cls.download_publish(log_type=log_type,
|
|
|
|
+ crawler=crawler,
|
|
|
|
+ video_info_dict=video_info_dict,
|
|
|
|
+ rule_dict=rule_dict,
|
|
|
|
+ update_video_info=update_video_info,
|
|
|
|
+ strategy=strategy,
|
|
|
|
+ oss_endpoint=oss_endpoint,
|
|
|
|
+ env=env)
|
|
elif datetime.datetime.now().hour == 20 and datetime.datetime.now().minute <= 10:
|
|
elif datetime.datetime.now().hour == 20 and datetime.datetime.now().minute <= 10:
|
|
video_info_dict = cls.get_video_info(log_type=log_type,
|
|
video_info_dict = cls.get_video_info(log_type=log_type,
|
|
crawler=crawler,
|
|
crawler=crawler,
|
|
@@ -468,13 +497,19 @@ class XiaoniangaoHourScheduling:
|
|
update_sql = f""" update crawler_xiaoniangao_hour set twenty_play_cnt={twenty_play_cnt} WHERE out_video_id="{video_id}"; """
|
|
update_sql = f""" update crawler_xiaoniangao_hour set twenty_play_cnt={twenty_play_cnt} WHERE out_video_id="{video_id}"; """
|
|
# Common.logger(log_type, crawler).info(f"update_sql:{update_sql}")
|
|
# Common.logger(log_type, crawler).info(f"update_sql:{update_sql}")
|
|
MysqlHelper.update_values(log_type, crawler, update_sql, env)
|
|
MysqlHelper.update_values(log_type, crawler, update_sql, env)
|
|
- cls.download_publish(log_type, crawler, video_info_dict, update_video_info, strategy, oss_endpoint,
|
|
|
|
- env)
|
|
|
|
|
|
+ cls.download_publish(log_type=log_type,
|
|
|
|
+ crawler=crawler,
|
|
|
|
+ video_info_dict=video_info_dict,
|
|
|
|
+ rule_dict=rule_dict,
|
|
|
|
+ update_video_info=update_video_info,
|
|
|
|
+ strategy=strategy,
|
|
|
|
+ oss_endpoint=oss_endpoint,
|
|
|
|
+ env=env)
|
|
else:
|
|
else:
|
|
pass
|
|
pass
|
|
|
|
|
|
@classmethod
|
|
@classmethod
|
|
- def download(cls, log_type, crawler, video_info_dict, strategy, oss_endpoint, env):
|
|
|
|
|
|
+ def download(cls, log_type, crawler, video_info_dict, rule_dict, strategy, oss_endpoint, env):
|
|
# 下载封面
|
|
# 下载封面
|
|
Common.download_method(log_type=log_type, crawler=crawler, text="cover", title=video_info_dict["video_title"],
|
|
Common.download_method(log_type=log_type, crawler=crawler, text="cover", title=video_info_dict["video_title"],
|
|
url=video_info_dict["cover_url"])
|
|
url=video_info_dict["cover_url"])
|
|
@@ -503,12 +538,12 @@ class XiaoniangaoHourScheduling:
|
|
shutil.rmtree(f"./{crawler}/videos/{video_info_dict['video_title']}")
|
|
shutil.rmtree(f"./{crawler}/videos/{video_info_dict['video_title']}")
|
|
return
|
|
return
|
|
|
|
|
|
- # 视频信息保存数据库
|
|
|
|
- rule_dict = {
|
|
|
|
- "duration": {"min": 40},
|
|
|
|
- "play_cnt": {"min": 4000},
|
|
|
|
- "publish_day": {"min": 10}
|
|
|
|
- }
|
|
|
|
|
|
+ # # 视频信息保存数据库
|
|
|
|
+ # rule_dict = {
|
|
|
|
+ # "duration": {"min": 40},
|
|
|
|
+ # "play_cnt": {"min": 4000},
|
|
|
|
+ # "publish_day": {"min": 10}
|
|
|
|
+ # }
|
|
|
|
|
|
insert_sql = f""" insert into crawler_video(video_id,
|
|
insert_sql = f""" insert into crawler_video(video_id,
|
|
out_user_id,
|
|
out_user_id,
|
|
@@ -570,14 +605,20 @@ class XiaoniangaoHourScheduling:
|
|
|
|
|
|
# 下载/上传
|
|
# 下载/上传
|
|
@classmethod
|
|
@classmethod
|
|
- def download_publish(cls, log_type, crawler, video_info_dict, update_video_info, strategy, oss_endpoint, env):
|
|
|
|
|
|
+ def download_publish(cls, log_type, crawler, video_info_dict, rule_dict, update_video_info, strategy, oss_endpoint, env):
|
|
if cls.repeat_video(log_type, crawler, video_info_dict["video_id"], env) != 0:
|
|
if cls.repeat_video(log_type, crawler, video_info_dict["video_id"], env) != 0:
|
|
Common.logger(log_type, crawler).info('视频已下载\n')
|
|
Common.logger(log_type, crawler).info('视频已下载\n')
|
|
# 播放量大于 50000,直接下载
|
|
# 播放量大于 50000,直接下载
|
|
elif int(video_info_dict["play_cnt"]) >= 50000:
|
|
elif int(video_info_dict["play_cnt"]) >= 50000:
|
|
Common.logger(log_type, crawler).info(
|
|
Common.logger(log_type, crawler).info(
|
|
f"播放量:{video_info_dict['play_cnt']} >= 50000,满足下载规则,开始下载视频")
|
|
f"播放量:{video_info_dict['play_cnt']} >= 50000,满足下载规则,开始下载视频")
|
|
- cls.download(log_type, crawler, video_info_dict, strategy, oss_endpoint, env)
|
|
|
|
|
|
+ cls.download(log_type=log_type,
|
|
|
|
+ crawler=crawler,
|
|
|
|
+ video_info_dict=video_info_dict,
|
|
|
|
+ rule_dict=rule_dict,
|
|
|
|
+ strategy=strategy,
|
|
|
|
+ oss_endpoint=oss_endpoint,
|
|
|
|
+ env=env)
|
|
|
|
|
|
# 上升榜判断逻辑,任意时间段上升量>=5000,连续两个时间段上升量>=2000
|
|
# 上升榜判断逻辑,任意时间段上升量>=5000,连续两个时间段上升量>=2000
|
|
elif int(update_video_info['ten_play_cnt']) >= 5000 or int(
|
|
elif int(update_video_info['ten_play_cnt']) >= 5000 or int(
|
|
@@ -585,25 +626,49 @@ class XiaoniangaoHourScheduling:
|
|
Common.logger(log_type, crawler).info(
|
|
Common.logger(log_type, crawler).info(
|
|
f"10:00 or 15:00 or 20:00 数据上升量:{int(update_video_info['ten_play_cnt'])} or {int(update_video_info['fifteen_play_cnt'])} or {int(update_video_info['twenty_play_cnt'])} >= 5000")
|
|
f"10:00 or 15:00 or 20:00 数据上升量:{int(update_video_info['ten_play_cnt'])} or {int(update_video_info['fifteen_play_cnt'])} or {int(update_video_info['twenty_play_cnt'])} >= 5000")
|
|
Common.logger(log_type, crawler).info("满足下载规则,开始下载视频")
|
|
Common.logger(log_type, crawler).info("满足下载规则,开始下载视频")
|
|
- cls.download(log_type, crawler, video_info_dict, strategy, oss_endpoint, env)
|
|
|
|
|
|
+ cls.download(log_type=log_type,
|
|
|
|
+ crawler=crawler,
|
|
|
|
+ video_info_dict=video_info_dict,
|
|
|
|
+ rule_dict=rule_dict,
|
|
|
|
+ strategy=strategy,
|
|
|
|
+ oss_endpoint=oss_endpoint,
|
|
|
|
+ env=env)
|
|
|
|
|
|
elif int(update_video_info['ten_play_cnt']) >= 2000 and int(update_video_info['fifteen_play_cnt']) >= 2000:
|
|
elif int(update_video_info['ten_play_cnt']) >= 2000 and int(update_video_info['fifteen_play_cnt']) >= 2000:
|
|
Common.logger(log_type, crawler).info(
|
|
Common.logger(log_type, crawler).info(
|
|
f"10:00 and 15:00 数据上升量:{int(update_video_info['ten_play_cnt'])} and {int(update_video_info['fifteen_play_cnt'])} >= 2000")
|
|
f"10:00 and 15:00 数据上升量:{int(update_video_info['ten_play_cnt'])} and {int(update_video_info['fifteen_play_cnt'])} >= 2000")
|
|
Common.logger(log_type, crawler).info("满足下载规则,开始下载视频")
|
|
Common.logger(log_type, crawler).info("满足下载规则,开始下载视频")
|
|
- cls.download(log_type, crawler, video_info_dict, strategy, oss_endpoint, env)
|
|
|
|
|
|
+ cls.download(log_type=log_type,
|
|
|
|
+ crawler=crawler,
|
|
|
|
+ video_info_dict=video_info_dict,
|
|
|
|
+ rule_dict=rule_dict,
|
|
|
|
+ strategy=strategy,
|
|
|
|
+ oss_endpoint=oss_endpoint,
|
|
|
|
+ env=env)
|
|
|
|
|
|
elif int(update_video_info['fifteen_play_cnt']) >= 2000 and int(update_video_info['twenty_play_cnt']) >= 2000:
|
|
elif int(update_video_info['fifteen_play_cnt']) >= 2000 and int(update_video_info['twenty_play_cnt']) >= 2000:
|
|
Common.logger(log_type, crawler).info(
|
|
Common.logger(log_type, crawler).info(
|
|
f"15:00 and 20:00 数据上升量:{int(update_video_info['fifteen_play_cnt'])} and {int(update_video_info['twenty_play_cnt'])} >= 2000")
|
|
f"15:00 and 20:00 数据上升量:{int(update_video_info['fifteen_play_cnt'])} and {int(update_video_info['twenty_play_cnt'])} >= 2000")
|
|
Common.logger(log_type, crawler).info("满足下载规则,开始下载视频")
|
|
Common.logger(log_type, crawler).info("满足下载规则,开始下载视频")
|
|
- cls.download(log_type, crawler, video_info_dict, strategy, oss_endpoint, env)
|
|
|
|
|
|
+ cls.download(log_type=log_type,
|
|
|
|
+ crawler=crawler,
|
|
|
|
+ video_info_dict=video_info_dict,
|
|
|
|
+ rule_dict=rule_dict,
|
|
|
|
+ strategy=strategy,
|
|
|
|
+ oss_endpoint=oss_endpoint,
|
|
|
|
+ env=env)
|
|
|
|
|
|
elif int(update_video_info['ten_play_cnt']) >= 2000 and int(update_video_info['twenty_play_cnt']) >= 2000:
|
|
elif int(update_video_info['ten_play_cnt']) >= 2000 and int(update_video_info['twenty_play_cnt']) >= 2000:
|
|
Common.logger(log_type, crawler).info(
|
|
Common.logger(log_type, crawler).info(
|
|
f"今日10:00 / 20:00数据上升量:{int(update_video_info['ten_play_cnt'])} and {int(update_video_info['twenty_play_cnt'])} >= 2000")
|
|
f"今日10:00 / 20:00数据上升量:{int(update_video_info['ten_play_cnt'])} and {int(update_video_info['twenty_play_cnt'])} >= 2000")
|
|
Common.logger(log_type, crawler).info("满足下载规则,开始下载视频")
|
|
Common.logger(log_type, crawler).info("满足下载规则,开始下载视频")
|
|
- cls.download(log_type, crawler, video_info_dict, strategy, oss_endpoint, env)
|
|
|
|
|
|
+ cls.download(log_type=log_type,
|
|
|
|
+ crawler=crawler,
|
|
|
|
+ video_info_dict=video_info_dict,
|
|
|
|
+ rule_dict=rule_dict,
|
|
|
|
+ strategy=strategy,
|
|
|
|
+ oss_endpoint=oss_endpoint,
|
|
|
|
+ env=env)
|
|
|
|
|
|
else:
|
|
else:
|
|
Common.logger(log_type, crawler).info("上升量不满足下载规则")
|
|
Common.logger(log_type, crawler).info("上升量不满足下载规则")
|