|
@@ -10,10 +10,12 @@ import sys
|
|
|
import time
|
|
|
import requests
|
|
|
import urllib3
|
|
|
+
|
|
|
sys.path.append(os.getcwd())
|
|
|
from main.common import Common
|
|
|
from main.feishu_lib import Feishu
|
|
|
from main.publish import Publish
|
|
|
+
|
|
|
proxies = {"http": None, "https": None}
|
|
|
|
|
|
|
|
@@ -158,12 +160,11 @@ class KuaiShou:
|
|
|
title3 = title_split3[-1]
|
|
|
|
|
|
video_title = title3.strip().replace("\n", "") \
|
|
|
- .replace("/", "").replace("快手", "").replace(" ", "") \
|
|
|
- .replace(" ", "").replace("&NBSP", "").replace("\r", "") \
|
|
|
- .replace("#", "").replace(".", "。").replace("\\", "") \
|
|
|
- .replace(":", "").replace("*", "").replace("?", "") \
|
|
|
- .replace("?", "").replace('"', "").replace("<", "") \
|
|
|
- .replace(">", "").replace("|", "")[:40]
|
|
|
+ .replace("/", "").replace("快手", "").replace(" ", "").replace(" ", "") \
|
|
|
+ .replace("&NBSP", "").replace("\r", "").replace("#", "").replace(".", "。") \
|
|
|
+ .replace("\\", "").replace(":", "").replace("*", "").replace("?", "") \
|
|
|
+ .replace("?", "").replace('"', "").replace("<", "").replace(">", "").replace("|", "")[
|
|
|
+ :40]
|
|
|
|
|
|
if "photoId" not in feeds[i]:
|
|
|
video_id = "0"
|
|
@@ -260,10 +261,10 @@ class KuaiShou:
|
|
|
elif any(word if word in kuaishou_title else False for word in cls.sensitive_words()) is True:
|
|
|
Common.logger(log_type).info("视频已中敏感词:{}\n".format(kuaishou_title))
|
|
|
# 从 云文档 去重:https://w42nne6hzg.feishu.cn/sheets/shtcnp4SaJt37q6OOOrYzPMjQkg?sheet=3cd128
|
|
|
- elif video_id in [j for m in Feishu.get_values_batch(log_type, "kuaishou", "3cd128") for j in m]:
|
|
|
+ elif str(video_id) in [j for m in Feishu.get_values_batch(log_type, "kuaishou", "3cd128") for j in m]:
|
|
|
Common.logger(log_type).info("该视频已下载:{}\n", video_title)
|
|
|
# 从 云文档 去重:https://w42nne6hzg.feishu.cn/sheets/shtcnp4SaJt37q6OOOrYzPMjQkg?sheet=JK6npf
|
|
|
- elif video_id in [j for n in Feishu.get_values_batch(log_type, "kuaishou", "JK6npf") for j in n]:
|
|
|
+ elif str(video_id) in [j for n in Feishu.get_values_batch(log_type, "kuaishou", "JK6npf") for j in n]:
|
|
|
Common.logger(log_type).info("该视频已在feeds中:{}\n", video_title)
|
|
|
else:
|
|
|
# feeds工作表,插入首行
|
|
@@ -275,7 +276,7 @@ class KuaiShou:
|
|
|
# 看一看云文档,工作表 kanyikan_feeds_1 中写入数据
|
|
|
values = [[str(time.strftime("%Y/%m/%d %H:%M:%S", time.localtime(get_feeds_time))),
|
|
|
"推荐榜",
|
|
|
- video_id,
|
|
|
+ str(video_id),
|
|
|
video_title,
|
|
|
video_play_cnt,
|
|
|
video_comment_cnt,
|
|
@@ -347,8 +348,8 @@ class KuaiShou:
|
|
|
Common.logger(log_type).info("空行,删除成功\n")
|
|
|
return
|
|
|
# 去重
|
|
|
- elif download_video_id in [j for m in Feishu.get_values_batch(log_type, "kuaishou", "3cd128") for j in
|
|
|
- m]:
|
|
|
+ elif str(download_video_id) in [j for m in Feishu.get_values_batch(log_type, "kuaishou", "3cd128") for j
|
|
|
+ in m]:
|
|
|
# 删除行或列,可选 ROWS、COLUMNS
|
|
|
Feishu.dimension_range(log_type, "kuaishou", "JK6npf", "ROWS", i + 1, i + 1)
|
|
|
Common.logger(log_type).info("该视频已下载:{},删除成功\n", download_video_title)
|