|
@@ -129,10 +129,10 @@ class DownloadUp:
|
|
|
# 下载视频
|
|
|
Common.download_method("video", v_title, download_url_up)
|
|
|
# 保存视频 ID 到 "./txt/kanyikan_videoid.txt"
|
|
|
- with open("./txt/kanyikan_videoid.txt", "a", encoding="utf8") as f_a:
|
|
|
+ with open(r"./txt/kanyikan_videoid.txt", "a", encoding="utf8") as f_a:
|
|
|
f_a.write(v_id + "\n")
|
|
|
# 保存视频信息到 "./files/{视频标题}/videoinfo.txt"
|
|
|
- with open("./videos/" + v_title + "/" + "info.txt",
|
|
|
+ with open(r"./videos/" + v_title + "/" + "info.txt",
|
|
|
"a", encoding="utf8") as f_a2:
|
|
|
f_a2.write(str(v_id) + "\n" +
|
|
|
str(v_title) + "\n" +
|
|
@@ -155,9 +155,9 @@ class DownloadUp:
|
|
|
|
|
|
# 删除该视频在kanyikan_feeds.txt中的信息
|
|
|
Common.crawler_log().info("删除该视频在kanyikan_feeds.txt中的信息:{}".format(v_title))
|
|
|
- with open("./txt/kanyikan_feeds.txt", "r", encoding="utf8") as f1:
|
|
|
+ with open(r"./txt/kanyikan_feeds.txt", "r", encoding="utf8") as f1:
|
|
|
lines = f1.readlines()
|
|
|
- with open("./txt/kanyikan_feeds.txt", "w", encoding="utf-8") as f_w1:
|
|
|
+ with open(r"./txt/kanyikan_feeds.txt", "w", encoding="utf-8") as f_w1:
|
|
|
for line1 in lines:
|
|
|
if v_id in line1.split(" + ")[1]:
|
|
|
continue
|
|
@@ -167,14 +167,14 @@ class DownloadUp:
|
|
|
Common.crawler_log().info("该视频1小时内的播放量:{}<1000".format(
|
|
|
int(v_play_cnt_up) - int(v_play_ctn)) + ";"
|
|
|
+ "更新该视频在kanyikan_feeds.txt中的信息:{}".format(v_title))
|
|
|
- with open("./txt/kanyikan_feeds.txt", "r", encoding="utf8") as f_r:
|
|
|
+ with open(r"./txt/kanyikan_feeds.txt", "r", encoding="utf8") as f_r:
|
|
|
lines = f_r.readlines()
|
|
|
- with open("./txt/kanyikan_feeds.txt", "w", encoding="utf-8") as f_w:
|
|
|
+ with open(r"./txt/kanyikan_feeds.txt", "w", encoding="utf-8") as f_w:
|
|
|
for line2 in lines:
|
|
|
if v_id in line2.split(" + ")[1]:
|
|
|
continue
|
|
|
f_w.write(line2)
|
|
|
- with open("./txt/kanyikan_feeds.txt", "a", encoding="utf-8") as f_a:
|
|
|
+ with open(r"./txt/kanyikan_feeds.txt", "a", encoding="utf-8") as f_a:
|
|
|
f_a.write(str(int(time.time())) + " + "
|
|
|
+ str(v_id) + " + "
|
|
|
+ str(v_play_cnt_up) + " + "
|
|
@@ -196,9 +196,9 @@ class DownloadUp:
|
|
|
int((int(time.time()) - int(v_time)) / 60)) + ";" + "标题:{}".format(v_title))
|
|
|
# 删除之前保存的该视频信息
|
|
|
Common.crawler_log().info("删除该视频在kanyikan_feeds.txt中的信息:{}".format(v_title))
|
|
|
- with open("./txt/kanyikan_feeds.txt", "r", encoding="utf8") as f_r:
|
|
|
+ with open(r"./txt/kanyikan_feeds.txt", "r", encoding="utf8") as f_r:
|
|
|
lines = f_r.readlines()
|
|
|
- with open("./txt/kanyikan_feeds.txt", "w", encoding="utf-8") as f_w:
|
|
|
+ with open(r"./txt/kanyikan_feeds.txt", "w", encoding="utf-8") as f_w:
|
|
|
for line2 in lines:
|
|
|
if v_id in line2.split(" + ")[1]:
|
|
|
continue
|
|
@@ -207,9 +207,9 @@ class DownloadUp:
|
|
|
Common.crawler_log().info("不满足下载规则:{}".format(v_title))
|
|
|
# 删除之前保存的该视频信息
|
|
|
Common.crawler_log().info("删除该视频在kanyikan_feeds.txt中的信息:{}".format(v_title))
|
|
|
- with open("./txt/kanyikan_feeds.txt", "r", encoding="utf8") as f_r:
|
|
|
+ with open(r"./txt/kanyikan_feeds.txt", "r", encoding="utf8") as f_r:
|
|
|
lines = f_r.readlines()
|
|
|
- with open("./txt/kanyikan_feeds.txt", "w", encoding="utf-8") as f_w:
|
|
|
+ with open(r"./txt/kanyikan_feeds.txt", "w", encoding="utf-8") as f_w:
|
|
|
for line3 in lines:
|
|
|
if v_id in line3.split(" + ")[1]:
|
|
|
continue
|
|
@@ -217,9 +217,9 @@ class DownloadUp:
|
|
|
except Exception as e:
|
|
|
Common.crawler_log().error("获取视频info异常:{},删除该视频".format(e))
|
|
|
# 删除之前保存的该视频信息
|
|
|
- with open("./txt/kanyikan_feeds.txt", "r", encoding="utf8") as f_r:
|
|
|
+ with open(r"./txt/kanyikan_feeds.txt", "r", encoding="utf8") as f_r:
|
|
|
lines = f_r.readlines()
|
|
|
- with open("./txt/kanyikan_feeds.txt", "w", encoding="utf-8") as f_w:
|
|
|
+ with open(r"./txt/kanyikan_feeds.txt", "w", encoding="utf-8") as f_w:
|
|
|
for line4 in lines:
|
|
|
if v_id in line4.split(" + ")[1]:
|
|
|
continue
|