|
@@ -24,7 +24,7 @@ class Follow:
|
|
|
# 视频发布时间
|
|
|
send_time = 0
|
|
|
# 配置微信
|
|
|
- wechat_sheet = Feishu.get_values_batch("follow", "kuaishou", "f1R7Mx")
|
|
|
+ wechat_sheet = Feishu.get_values_batch("follow", "kuaishou", "WFF4jw")
|
|
|
Referer = wechat_sheet[2][3]
|
|
|
NS_sig3 = wechat_sheet[3][3]
|
|
|
NS_sig3_origin = wechat_sheet[4][3]
|
|
@@ -44,7 +44,7 @@ class Follow:
|
|
|
# 敏感词库列表
|
|
|
word_list = []
|
|
|
# 从云文档读取所有敏感词,添加到词库列表
|
|
|
- lists = Feishu.get_values_batch("follow", "kuaishou", "fn8IDi")
|
|
|
+ lists = Feishu.get_values_batch("follow", "kuaishou", "HIKVvs")
|
|
|
for i in lists:
|
|
|
for j in i:
|
|
|
# 过滤空的单元格内容
|
|
@@ -86,7 +86,7 @@ class Follow:
|
|
|
def get_sub_or_fans_list(cls, log_type):
|
|
|
try:
|
|
|
follow_list = []
|
|
|
- follow_sheet = Feishu.get_values_batch(log_type, "kuaishou", "MGMsHE")
|
|
|
+ follow_sheet = Feishu.get_values_batch(log_type, "kuaishou", "2OLxLr")
|
|
|
url = "https://wxmini-api.uyouqu.com/rest/wd/wechatApp/relation/fol?"
|
|
|
headers = {
|
|
|
"content-type": "application/json",
|
|
@@ -149,10 +149,10 @@ class Follow:
|
|
|
# 同步已关注的用户至云文档
|
|
|
if uid not in [j for i in follow_sheet for j in i]:
|
|
|
time.sleep(1)
|
|
|
- Feishu.insert_columns(log_type, "kuaishou", "MGMsHE", "ROWS", 1, 2)
|
|
|
+ Feishu.insert_columns(log_type, "kuaishou", "2OLxLr", "ROWS", 1, 2)
|
|
|
time.sleep(1)
|
|
|
values = [[uid, nick, sex, description, follow_reason, follow_time, str(is_friend)]]
|
|
|
- Feishu.update_values(log_type, "kuaishou", "MGMsHE", "A2:L2", values)
|
|
|
+ Feishu.update_values(log_type, "kuaishou", "2OLxLr", "A2:L2", values)
|
|
|
else:
|
|
|
Common.logger(log_type).info("用户:{},在云文档中已存在", nick)
|
|
|
cls.follow_pcursor = r.json()["pcursor"]
|
|
@@ -168,7 +168,7 @@ class Follow:
|
|
|
@classmethod
|
|
|
def get_follow_users(cls, log_type):
|
|
|
try:
|
|
|
- follow_sheet = Feishu.get_values_batch(log_type, "kuaishou", "MGMsHE")
|
|
|
+ follow_sheet = Feishu.get_values_batch(log_type, "kuaishou", "2OLxLr")
|
|
|
if len(follow_sheet) == 1:
|
|
|
Common.logger(log_type).info("暂无关注用户")
|
|
|
else:
|
|
@@ -188,7 +188,7 @@ class Follow:
|
|
|
@classmethod
|
|
|
def get_unfollow_users(cls, log_type):
|
|
|
try:
|
|
|
- unfollow_sheet = Feishu.get_values_batch(log_type, "kuaishou", "Lms83Y")
|
|
|
+ unfollow_sheet = Feishu.get_values_batch(log_type, "kuaishou", "WRveYg")
|
|
|
if len(unfollow_sheet) == 1:
|
|
|
Common.logger(log_type).info("暂无取消关注用户")
|
|
|
else:
|
|
@@ -464,14 +464,14 @@ class Follow:
|
|
|
# 判断敏感词
|
|
|
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=3b207c
|
|
|
- elif video_id in [j for m in Feishu.get_values_batch(log_type, "kuaishou", "3b207c") for j in m]:
|
|
|
+ # 从 云文档 去重: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]:
|
|
|
Common.logger(log_type).info("该视频已下载:{}\n", video_title)
|
|
|
- # 从 云文档 去重:https://w42nne6hzg.feishu.cn/sheets/shtcnp4SaJt37q6OOOrYzPMjQkg?sheet=bnj9op
|
|
|
- elif video_id in [j for n in Feishu.get_values_batch(log_type, "kuaishou", "bnj9op") for j in n]:
|
|
|
+ # 从 云文档 去重:https://w42nne6hzg.feishu.cn/sheets/shtcnp4SaJt37q6OOOrYzPMjQkg?sheet=wW5cyb
|
|
|
+ elif video_id in [j for n in Feishu.get_values_batch(log_type, "kuaishou", "wW5cyb") for j in n]:
|
|
|
Common.logger(log_type).info("该视频已在feeds中:{}\n", video_title)
|
|
|
else:
|
|
|
- Feishu.insert_columns("follow", "kuaishou", "bnj9op", "ROWS", 1, 2)
|
|
|
+ Feishu.insert_columns("follow", "kuaishou", "wW5cyb", "ROWS", 1, 2)
|
|
|
# 获取当前时间
|
|
|
get_feeds_time = int(time.time())
|
|
|
# 工作表中写入数据
|
|
@@ -494,7 +494,7 @@ class Follow:
|
|
|
video_url]]
|
|
|
# 等待 1s,防止操作云文档太频繁,导致报错
|
|
|
time.sleep(1)
|
|
|
- Feishu.update_values("follow", "kuaishou", "bnj9op", "A2:P2", values)
|
|
|
+ Feishu.update_values("follow", "kuaishou", "wW5cyb", "A2:P2", values)
|
|
|
Common.logger("follow").info("添加视频至follow_feeds成功:{}\n", video_title)
|
|
|
|
|
|
# 翻页
|
|
@@ -514,7 +514,7 @@ class Follow:
|
|
|
def get_videos_from_follow(cls, log_type):
|
|
|
try:
|
|
|
# 已关注的用户列表 uids
|
|
|
- uid_sheet = Feishu.get_values_batch(log_type, "kuaishou", "MGMsHE")
|
|
|
+ uid_sheet = Feishu.get_values_batch(log_type, "kuaishou", "2OLxLr")
|
|
|
for i in range(1, len(uid_sheet)):
|
|
|
uid = uid_sheet[i][0]
|
|
|
nick = uid_sheet[i][1]
|
|
@@ -528,7 +528,7 @@ class Follow:
|
|
|
@classmethod
|
|
|
def download_publish(cls, log_type, env):
|
|
|
try:
|
|
|
- follow_feeds_sheet = Feishu.get_values_batch(log_type, "kuaishou", "bnj9op")
|
|
|
+ follow_feeds_sheet = Feishu.get_values_batch(log_type, "kuaishou", "wW5cyb")
|
|
|
for i in range(1, len(follow_feeds_sheet)):
|
|
|
time.sleep(1)
|
|
|
download_video_id = follow_feeds_sheet[i][2]
|
|
@@ -571,7 +571,7 @@ class Follow:
|
|
|
or download_video_title is None \
|
|
|
or download_video_title == "":
|
|
|
# 删除行或列,可选 ROWS、COLUMNS
|
|
|
- Feishu.dimension_range(log_type, "kuaishou", "bnj9op", "ROWS", i + 1, i + 1)
|
|
|
+ Feishu.dimension_range(log_type, "kuaishou", "wW5cyb", "ROWS", i + 1, i + 1)
|
|
|
Common.logger(log_type).warning("标题为空或空行,删除成功\n")
|
|
|
return
|
|
|
# 下载规则
|
|
@@ -580,14 +580,14 @@ class Follow:
|
|
|
download_video_resolution.split("*")[-1], download_video_play_cnt, download_video_like_cnt,
|
|
|
download_video_share_cnt) is False:
|
|
|
# 删除行或列,可选 ROWS、COLUMNS
|
|
|
- Feishu.dimension_range(log_type, "kuaishou", "bnj9op", "ROWS", i + 1, i + 1)
|
|
|
+ Feishu.dimension_range(log_type, "kuaishou", "wW5cyb", "ROWS", i + 1, i + 1)
|
|
|
Common.logger(log_type).info("不满足下载规则:{},删除成功\n", download_video_title)
|
|
|
return
|
|
|
# 从已下载视频表中去重
|
|
|
elif download_video_id in [j for m in Feishu.get_values_batch(
|
|
|
- log_type, "kuaishou", "3b207c") for j in m]:
|
|
|
+ log_type, "kuaishou", "3cd128") for j in m]:
|
|
|
# 删除行或列,可选 ROWS、COLUMNS
|
|
|
- Feishu.dimension_range(log_type, "kuaishou", "bnj9op", "ROWS", i + 1, i + 1)
|
|
|
+ Feishu.dimension_range(log_type, "kuaishou", "wW5cyb", "ROWS", i + 1, i + 1)
|
|
|
Common.logger(log_type).info("视频已下载:{},删除成功\n", download_video_title)
|
|
|
return
|
|
|
else:
|
|
@@ -623,10 +623,10 @@ class Follow:
|
|
|
our_video_link = "https://admin.piaoquantv.com/cms/post-detail/" + str(our_video_id) + "/info"
|
|
|
Common.logger(log_type).info("视频上传完成:{}", download_video_title)
|
|
|
|
|
|
- # 保存视频 ID 到云文档:https://w42nne6hzg.feishu.cn/sheets/shtcnp4SaJt37q6OOOrYzPMjQkg?sheet=3b207c
|
|
|
+ # 保存视频 ID 到云文档:https://w42nne6hzg.feishu.cn/sheets/shtcnp4SaJt37q6OOOrYzPMjQkg?sheet=3cd128
|
|
|
Common.logger(log_type).info("保存视频ID至云文档:{}", download_video_title)
|
|
|
# 视频ID工作表,插入首行
|
|
|
- Feishu.insert_columns(log_type, "kuaishou", "3b207c", "ROWS", 1, 2)
|
|
|
+ Feishu.insert_columns(log_type, "kuaishou", "3cd128", "ROWS", 1, 2)
|
|
|
# 视频ID工作表,首行写入数据
|
|
|
upload_time = int(time.time())
|
|
|
values = [[time.strftime("%Y/%m/%d %H:%M:%S", time.localtime(upload_time)),
|
|
@@ -647,10 +647,10 @@ class Follow:
|
|
|
str(download_cover_url),
|
|
|
str(download_video_url)]]
|
|
|
time.sleep(1)
|
|
|
- Feishu.update_values(log_type, "kuaishou", "3b207c", "F2:V2", values)
|
|
|
+ Feishu.update_values(log_type, "kuaishou", "3cd128", "F2:V2", values)
|
|
|
|
|
|
# 删除行或列,可选 ROWS、COLUMNS
|
|
|
- Feishu.dimension_range(log_type, "kuaishou", "bnj9op", "ROWS", i + 1, i + 1)
|
|
|
+ Feishu.dimension_range(log_type, "kuaishou", "wW5cyb", "ROWS", i + 1, i + 1)
|
|
|
Common.logger(log_type).info("视频:{},下载/上传成功\n", download_video_title)
|
|
|
return
|
|
|
except Exception as e:
|
|
@@ -661,7 +661,7 @@ class Follow:
|
|
|
def run_download_publish(cls, log_type, env):
|
|
|
try:
|
|
|
while True:
|
|
|
- follow_feeds_sheet = Feishu.get_values_batch(log_type, "kuaishou", "bnj9op")
|
|
|
+ follow_feeds_sheet = Feishu.get_values_batch(log_type, "kuaishou", "wW5cyb")
|
|
|
if len(follow_feeds_sheet) == 1:
|
|
|
Common.logger(log_type).info("下载/上传完成")
|
|
|
break
|
|
@@ -675,6 +675,6 @@ if __name__ == "__main__":
|
|
|
follow = Follow()
|
|
|
# follow.get_videos_from_follow("follow")
|
|
|
# follow.follow_unfollow("follow", "follow", "687090964")
|
|
|
- follow.get_videos_from_person("follow", "240529022")
|
|
|
+ follow.get_videos_from_person("follow", "1501445724")
|
|
|
# print(follow.Referer)
|
|
|
# print(follow.NS_sig3)
|