|
@@ -308,7 +308,7 @@ class KuaiShou:
|
|
|
else:
|
|
|
basic_time = int(time.time())
|
|
|
Common.crawler_log().info("添加视频信息至kuaishou_feeds.txt:{}".format(video_title))
|
|
|
- with open("./txt/kuaishou_feeds.txt", "a", encoding="UTF-8") as f_a:
|
|
|
+ with open(r"./txt/kuaishou_feeds.txt", "a", encoding="UTF-8") as f_a:
|
|
|
f_a.write(str(basic_time) + " + " +
|
|
|
str(photo_id) + " + " +
|
|
|
str(video_play_cnt) + " + " +
|
|
@@ -339,7 +339,7 @@ class KuaiShou:
|
|
|
else:
|
|
|
basic_time = int(time.time())
|
|
|
Common.crawler_log().info("添加视频信息至kuaishou_feeds.txt:{}".format(video_title))
|
|
|
- with open("./txt/kuaishou_feeds.txt", "a", encoding="UTF-8") as f_a:
|
|
|
+ with open(r"./txt/kuaishou_feeds.txt", "a", encoding="UTF-8") as f_a:
|
|
|
f_a.write(str(basic_time) + " + " +
|
|
|
str(photo_id) + " + " +
|
|
|
str(video_play_cnt) + " + " +
|
|
@@ -398,7 +398,7 @@ class KuaiShou:
|
|
|
Common.download_method(text="video", d_name=download_video_title, d_url=download_video_url)
|
|
|
|
|
|
# 保存视频信息至 kuaishou_videoid.txt
|
|
|
- with open("./txt/kuaishou_videoid.txt", "a", encoding="UTF-8") as fa:
|
|
|
+ with open(r"./txt/kuaishou_videoid.txt", "a", encoding="UTF-8") as fa:
|
|
|
fa.write(download_photo_id + "\n")
|
|
|
|
|
|
# 添加视频 ID 到 list,用于统计当次下载总数
|
|
@@ -409,7 +409,7 @@ class KuaiShou:
|
|
|
# fc.write(download_photo_id + "\n")
|
|
|
|
|
|
# 保存视频信息至 "./videos/{download_video_title}/info.txt"
|
|
|
- with open("./videos/" + download_video_title + "/info.txt", "a", encoding="UTF-8") as f_a:
|
|
|
+ with open(r"./videos/" + download_video_title + "/info.txt", "a", encoding="UTF-8") as f_a:
|
|
|
f_a.write(str(download_photo_id) + "\n" +
|
|
|
str(download_video_title) + "\n" +
|
|
|
str(download_video_duration) + "\n" +
|
|
@@ -435,9 +435,9 @@ class KuaiShou:
|
|
|
|
|
|
# 删除该视频在kuaishou_feeds.txt中的信息
|
|
|
Common.crawler_log().info("删除该视频在kuaishou_feeds.txt中的信息:{}".format(download_video_title))
|
|
|
- with open("./txt/kuaishou_feeds.txt", "r", encoding="UTF-8") as f_r:
|
|
|
+ with open(r"./txt/kuaishou_feeds.txt", "r", encoding="UTF-8") as f_r:
|
|
|
lines = f_r.readlines()
|
|
|
- with open("./txt/kuaishou_feeds.txt", "w", encoding="utf-8") as f_w:
|
|
|
+ with open(r"./txt/kuaishou_feeds.txt", "w", encoding="utf-8") as f_w:
|
|
|
for line in lines:
|
|
|
if download_photo_id in line.split(" + ")[1]:
|
|
|
continue
|
|
@@ -445,9 +445,9 @@ class KuaiShou:
|
|
|
else:
|
|
|
# 删除该视频在 recommend.txt中的信息
|
|
|
Common.crawler_log().info("该视频不满足下载规则,删除在kuaishou_feeds.txt中的信息:{}".format(download_video_title))
|
|
|
- with open("./txt/kuaishou_feeds.txt", "r", encoding="UTF-8") as f_r:
|
|
|
+ with open(r"./txt/kuaishou_feeds.txt", "r", encoding="UTF-8") as f_r:
|
|
|
lines = f_r.readlines()
|
|
|
- with open("./txt/kuaishou_feeds.txt", "w", encoding="utf-8") as f_w:
|
|
|
+ with open(r"./txt/kuaishou_feeds.txt", "w", encoding="utf-8") as f_w:
|
|
|
for line in lines:
|
|
|
if download_photo_id in line.split(" + ")[1]:
|
|
|
continue
|