|
@@ -306,7 +306,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="utf8") as f_a:
|
|
|
+ with open("./txt/kuaishou_feeds.txt", "a", encoding="UTF-8") as f_a:
|
|
|
f_a.write(str(basic_time) + " + " +
|
|
|
str(photo_id) + " + " +
|
|
|
str(video_play_cnt) + " + " +
|
|
@@ -337,7 +337,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="utf8") as f_a:
|
|
|
+ with open("./txt/kuaishou_feeds.txt", "a", encoding="UTF-8") as f_a:
|
|
|
f_a.write(str(basic_time) + " + " +
|
|
|
str(photo_id) + " + " +
|
|
|
str(video_play_cnt) + " + " +
|
|
@@ -396,18 +396,18 @@ 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="utf8") as fa:
|
|
|
+ with open("./txt/kuaishou_videoid.txt", "a", encoding="UTF-8") as fa:
|
|
|
fa.write(download_photo_id + "\n")
|
|
|
|
|
|
# 添加视频 ID 到 list,用于统计当次下载总数
|
|
|
cls.download_video_list.append(download_photo_id)
|
|
|
|
|
|
# # 保存视频信息至 {today}_kuaishou_videoid.txt
|
|
|
- # with open("./txt/" + str(Common.today) + "_kuaishou_videoid.txt", "a", encoding="utf8") as fc:
|
|
|
+ # with open("./txt/" + str(Common.today) + "_kuaishou_videoid.txt", "a", encoding="UTF-8") as fc:
|
|
|
# fc.write(download_photo_id + "\n")
|
|
|
|
|
|
# 保存视频信息至 "./videos/{download_video_title}/info.txt"
|
|
|
- with open("./videos/" + download_video_title + "/info.txt", "a", encoding="utf8") as f_a:
|
|
|
+ with open("./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" +
|
|
@@ -433,7 +433,7 @@ class KuaiShou:
|
|
|
|
|
|
# 删除该视频在kuaishou_feeds.txt中的信息
|
|
|
Common.crawler_log().info("删除该视频在kuaishou_feeds.txt中的信息:{}".format(download_video_title))
|
|
|
- with open("./txt/kuaishou_feeds.txt", "r", encoding="utf8") as f_r:
|
|
|
+ with open("./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:
|
|
|
for line in lines:
|
|
@@ -443,7 +443,7 @@ class KuaiShou:
|
|
|
else:
|
|
|
# 删除该视频在 recommend.txt中的信息
|
|
|
Common.crawler_log().info("该视频不满足下载规则,删除在kuaishou_feeds.txt中的信息:{}".format(download_video_title))
|
|
|
- with open("./txt/kuaishou_feeds.txt", "r", encoding="utf8") as f_r:
|
|
|
+ with open("./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:
|
|
|
for line in lines:
|