|
@@ -98,22 +98,23 @@ class DownloadUp:
|
|
|
v_user_cover = data["user_info"]["headimg_url"]
|
|
|
v_video_cover = data["cover_url"]
|
|
|
if "items" not in data["play_info"]:
|
|
|
- if len(data["play_info"]) > 1:
|
|
|
+ if len(data["play_info"]) > 2:
|
|
|
download_url_up = data["play_info"][2]["play_url"]
|
|
|
- # Common.crawler_log().info('视频下载地址:{}'.format(download_url_up))
|
|
|
else:
|
|
|
download_url_up = data["play_info"][0]["play_url"]
|
|
|
- # Common.crawler_log().info('视频下载地址:{}'.format(download_url_up))
|
|
|
else:
|
|
|
- if len(data["play_info"]["items"]) > 1:
|
|
|
+ if len(data["play_info"]["items"]) > 2:
|
|
|
download_url_up = data["play_info"]["items"][2]["play_url"]
|
|
|
- # Common.crawler_log().info('视频下载地址:{}'.format(download_url_up))
|
|
|
else:
|
|
|
download_url_up = data["play_info"]["items"][0]["play_url"]
|
|
|
- # Common.crawler_log().info('视频下载地址:{}'.format(download_url_up))
|
|
|
|
|
|
# 判断基本规则
|
|
|
- if cls.up_rule(v_width, v_height, v_duration, v_play_cnt_up) is True:
|
|
|
+ if cls.up_rule(v_width, v_height, v_duration, v_play_cnt_up) is True \
|
|
|
+ and v_id != "" and v_title != "" and v_duration != "" \
|
|
|
+ and v_play_cnt_up != "" and v_comment_cnt != "" and v_liked_cnt != "" \
|
|
|
+ and v_shared_cnt != "" and v_width != "" and v_height != "" \
|
|
|
+ and v_send_date != "" and v_username != "" and v_user_cover != "" \
|
|
|
+ and v_video_cover != "" and download_url_up != "":
|
|
|
if int(time.time()) - int(v_time) < 3600:
|
|
|
Common.crawler_log().info("距上次获取该视频时间:{}分钟".format(
|
|
|
int(int(int(time.time()) - int(v_time)) / 60)) + ";{}".format(v_title))
|
|
@@ -173,20 +174,20 @@ class DownloadUp:
|
|
|
f_w.write(line2)
|
|
|
with open("./txt/kanyikan_feeds.txt", "a", encoding="utf-8") as f_a:
|
|
|
f_a.write(str(time.time()) + " + "
|
|
|
- + v_id + " + "
|
|
|
- + v_play_cnt_up + " + "
|
|
|
- + v_title + " + "
|
|
|
- + v_duration + " + "
|
|
|
- + v_comment_cnt + " + "
|
|
|
- + v_liked_cnt + " + "
|
|
|
- + v_shared_cnt + " + "
|
|
|
- + v_resolution + " + "
|
|
|
- + v_send_date + " + "
|
|
|
- + v_username + " + "
|
|
|
- + v_user_cover + " + "
|
|
|
- + v_video_cover + " + "
|
|
|
- + download_url_up + " + "
|
|
|
- + get_video_info_session + "\n")
|
|
|
+ + str(v_id) + " + "
|
|
|
+ + str(v_play_cnt_up) + " + "
|
|
|
+ + str(v_title) + " + "
|
|
|
+ + str(v_duration) + " + "
|
|
|
+ + str(v_comment_cnt) + " + "
|
|
|
+ + str(v_liked_cnt) + " + "
|
|
|
+ + str(v_shared_cnt) + " + "
|
|
|
+ + str(v_resolution) + " + "
|
|
|
+ + str(v_send_date) + " + "
|
|
|
+ + str(v_username) + " + "
|
|
|
+ + str(v_user_cover) + " + "
|
|
|
+ + str(v_video_cover) + " + "
|
|
|
+ + str(download_url_up) + " + "
|
|
|
+ + str(get_video_info_session) + "\n")
|
|
|
|
|
|
elif int(time.time()) - int(v_time) > 7200:
|
|
|
Common.crawler_log().info("距上次获取该视频时间:{}分钟。超过2小时,删除该视频".format(
|