|
@@ -27,9 +27,6 @@ class HourList:
|
|
hour_uid = wechat_sheet[5][1]
|
|
hour_uid = wechat_sheet[5][1]
|
|
hour_token = wechat_sheet[6][1]
|
|
hour_token = wechat_sheet[6][1]
|
|
|
|
|
|
-
|
|
|
|
-
|
|
|
|
-
|
|
|
|
|
|
|
|
@classmethod
|
|
@classmethod
|
|
def get_uid_token(cls):
|
|
def get_uid_token(cls):
|
|
@@ -238,29 +235,18 @@ class HourList:
|
|
expression = cls.get_expression()
|
|
expression = cls.get_expression()
|
|
expression_list = expression[0]
|
|
expression_list = expression[0]
|
|
char_list = expression[1]
|
|
char_list = expression[1]
|
|
-
|
|
|
|
-
|
|
|
|
|
|
|
|
expression = random.choice(expression_list)
|
|
expression = random.choice(expression_list)
|
|
-
|
|
|
|
|
|
|
|
expression_title_list = [expression + befor_video_title, befor_video_title + expression]
|
|
expression_title_list = [expression + befor_video_title, befor_video_title + expression]
|
|
-
|
|
|
|
|
|
|
|
title_list1 = random.choice(expression_title_list)
|
|
title_list1 = random.choice(expression_title_list)
|
|
-
|
|
|
|
|
|
|
|
title_list2 = befor_video_title + random.choice(char_list)
|
|
title_list2 = befor_video_title + random.choice(char_list)
|
|
-
|
|
|
|
-
|
|
|
|
-
|
|
|
|
-
|
|
|
|
|
|
|
|
title_list4 = [title_list2, title_list1]
|
|
title_list4 = [title_list2, title_list1]
|
|
-
|
|
|
|
|
|
|
|
video_title = random.choice(title_list4)
|
|
video_title = random.choice(title_list4)
|
|
-
|
|
|
|
else:
|
|
else:
|
|
video_title = 0
|
|
video_title = 0
|
|
|
|
|
|
@@ -288,12 +274,6 @@ class HourList:
|
|
else:
|
|
else:
|
|
video_share_cnt = 0
|
|
video_share_cnt = 0
|
|
|
|
|
|
-
|
|
|
|
-
|
|
|
|
-
|
|
|
|
-
|
|
|
|
-
|
|
|
|
-
|
|
|
|
|
|
|
|
if "du" in feeds[i]:
|
|
if "du" in feeds[i]:
|
|
video_duration = int(feeds[i]["du"] / 1000)
|
|
video_duration = int(feeds[i]["du"] / 1000)
|
|
@@ -345,17 +325,11 @@ class HourList:
|
|
Common.logger(log_type).info("标题:{}", video_title)
|
|
Common.logger(log_type).info("标题:{}", video_title)
|
|
Common.logger(log_type).info("视频ID:{}", video_id)
|
|
Common.logger(log_type).info("视频ID:{}", video_id)
|
|
Common.logger(log_type).info("播放量:{}", video_play_cnt)
|
|
Common.logger(log_type).info("播放量:{}", video_play_cnt)
|
|
-
|
|
|
|
-
|
|
|
|
-
|
|
|
|
Common.logger(log_type).info("时长:{}秒", video_duration)
|
|
Common.logger(log_type).info("时长:{}秒", video_duration)
|
|
-
|
|
|
|
Common.logger(log_type).info(
|
|
Common.logger(log_type).info(
|
|
"视频发布时间:{}", time.strftime(
|
|
"视频发布时间:{}", time.strftime(
|
|
"%Y/%m/%d %H:%M:%S", time.localtime(int(video_send_time) / 1000)))
|
|
"%Y/%m/%d %H:%M:%S", time.localtime(int(video_send_time) / 1000)))
|
|
Common.logger(log_type).info("用户名:{}", user_name)
|
|
Common.logger(log_type).info("用户名:{}", user_name)
|
|
-
|
|
|
|
-
|
|
|
|
Common.logger(log_type).info("播放地址:{}", video_url)
|
|
Common.logger(log_type).info("播放地址:{}", video_url)
|
|
|
|
|
|
|
|
|
|
@@ -364,6 +338,7 @@ class HourList:
|
|
or cover_url == 0 or video_url == 0:
|
|
or cover_url == 0 or video_url == 0:
|
|
Common.logger(log_type).warning("无效视频")
|
|
Common.logger(log_type).warning("无效视频")
|
|
|
|
|
|
|
|
+
|
|
elif cls.download_rule(video_duration, video_width, video_height, video_play_cnt,
|
|
elif cls.download_rule(video_duration, video_width, video_height, video_play_cnt,
|
|
video_like_cnt, video_share_cnt, video_send_time) is False:
|
|
video_like_cnt, video_share_cnt, video_send_time) is False:
|
|
Common.logger(log_type).info("不满足基础门槛规则")
|
|
Common.logger(log_type).info("不满足基础门槛规则")
|
|
@@ -373,22 +348,27 @@ class HourList:
|
|
Common.logger(log_type).info("视频已中敏感词:{}".format(video_title))
|
|
Common.logger(log_type).info("视频已中敏感词:{}".format(video_title))
|
|
time.sleep(1)
|
|
time.sleep(1)
|
|
|
|
|
|
-
|
|
+
|
|
elif video_id in [j for i in Feishu.get_values_batch(log_type, "xiaoniangao", "yatRv2") for j in i]:
|
|
elif video_id in [j for i in Feishu.get_values_batch(log_type, "xiaoniangao", "yatRv2") for j in i]:
|
|
Common.logger(log_type).info("该视频已下载:{}", video_title)
|
|
Common.logger(log_type).info("该视频已下载:{}", video_title)
|
|
time.sleep(1)
|
|
time.sleep(1)
|
|
|
|
|
|
-
|
|
+
|
|
- elif video_id in [j for i in Feishu.get_values_batch(log_type, "xiaoniangao", "2zD8cv") for j in i]:
|
|
+ elif video_id in [j for i in Feishu.get_values_batch(log_type, "xiaoniangao", "Wu0CeL") for j in i]:
|
|
|
|
+ Common.logger(log_type).info("该视频已下载:{}", video_title)
|
|
|
|
+ time.sleep(1)
|
|
|
|
+
|
|
|
|
+
|
|
|
|
+ elif video_id in [j for i in Feishu.get_values_batch(log_type, "xiaoniangao", "c85k1C") for j in i]:
|
|
Common.logger(log_type).info("该视频已下载:{}", video_title)
|
|
Common.logger(log_type).info("该视频已下载:{}", video_title)
|
|
time.sleep(1)
|
|
time.sleep(1)
|
|
|
|
|
|
-
|
|
+
|
|
elif video_id in [j for i in Feishu.get_values_batch("hour", "xiaoniangao", "ba0da4") for j in i]:
|
|
elif video_id in [j for i in Feishu.get_values_batch("hour", "xiaoniangao", "ba0da4") for j in i]:
|
|
Common.logger(log_type).info("该视频已保存过:{}", video_title)
|
|
Common.logger(log_type).info("该视频已保存过:{}", video_title)
|
|
time.sleep(1)
|
|
time.sleep(1)
|
|
|
|
+
|
|
else:
|
|
else:
|
|
- Common.logger(log_type).info("该视频未下载,添加至feeds中:{}".format(video_title))
|
|
|
|
|
|
|
|
time.sleep(1)
|
|
time.sleep(1)
|
|
Feishu.insert_columns(log_type, "xiaoniangao", "ba0da4", "ROWS", 2, 3)
|
|
Feishu.insert_columns(log_type, "xiaoniangao", "ba0da4", "ROWS", 2, 3)
|
|
@@ -410,9 +390,10 @@ class HourList:
|
|
|
|
|
|
time.sleep(1)
|
|
time.sleep(1)
|
|
Feishu.update_values(log_type, "xiaoniangao", "ba0da4", "A3:K3", values)
|
|
Feishu.update_values(log_type, "xiaoniangao", "ba0da4", "A3:K3", values)
|
|
|
|
+ Common.logger(log_type).info("视频添加至小时级数据_feeds成功:{}\n".format(video_title))
|
|
|
|
|
|
except Exception as e:
|
|
except Exception as e:
|
|
- Common.logger(log_type).error("获取小时榜视频列表异常:{}", e)
|
|
+ Common.logger(log_type).error("获取小时榜视频列表异常:{}\n", e)
|
|
|
|
|
|
|
|
|
|
@classmethod
|
|
@classmethod
|
|
@@ -710,7 +691,7 @@ class HourList:
|
|
except Exception as e:
|
|
except Exception as e:
|
|
Common.logger(log_type).error("视频详情:{},异常:{}", v_title, e)
|
|
Common.logger(log_type).error("视频详情:{},异常:{}", v_title, e)
|
|
except Exception as e:
|
|
except Exception as e:
|
|
- Common.logger(log_type).error("获取小时榜数据异常:{}", e)
|
|
+ Common.logger(log_type).error("获取小时榜数据异常:{}\n", e)
|
|
|
|
|
|
|
|
|
|
@classmethod
|
|
@classmethod
|
|
@@ -803,11 +784,14 @@ class HourList:
|
|
|
|
|
|
|
|
|
|
|
|
|
|
-
|
|
+
|
|
elif v_id in [j for i in Feishu.get_values_batch(log_type, "xiaoniangao", "yatRv2") for j in i]:
|
|
elif v_id in [j for i in Feishu.get_values_batch(log_type, "xiaoniangao", "yatRv2") for j in i]:
|
|
Common.logger(log_type).info("该视频已下载:{}", v_title)
|
|
Common.logger(log_type).info("该视频已下载:{}", v_title)
|
|
-
|
|
+
|
|
- elif v_id in [j for i in Feishu.get_values_batch(log_type, "xiaoniangao", "2zD8cv") for j in i]:
|
|
+ elif v_id in [j for i in Feishu.get_values_batch(log_type, "xiaoniangao", "Wu0CeL") for j in i]:
|
|
|
|
+ Common.logger(log_type).info("该视频已下载:{}", v_title)
|
|
|
|
+
|
|
|
|
+ elif v_id in [j for i in Feishu.get_values_batch(log_type, "xiaoniangao", "c85k1C") for j in i]:
|
|
Common.logger(log_type).info("该视频已下载:{}", v_title)
|
|
Common.logger(log_type).info("该视频已下载:{}", v_title)
|
|
|
|
|
|
|
|
|
|
@@ -942,25 +926,6 @@ class HourList:
|
|
time.sleep(1)
|
|
time.sleep(1)
|
|
Feishu.update_values(log_type, "xiaoniangao", "yatRv2", "F2:W2", values)
|
|
Feishu.update_values(log_type, "xiaoniangao", "yatRv2", "F2:W2", values)
|
|
|
|
|
|
-
|
|
|
|
- Common.logger(log_type).info("添加视频到监控表:{}", v_title)
|
|
|
|
-
|
|
|
|
- time.sleep(1)
|
|
|
|
- Feishu.insert_columns(log_type, "monitor", "N7e2yI", "ROWS", 1, 2)
|
|
|
|
-
|
|
|
|
- values = [[time.strftime("%Y/%m/%d %H:%M:%S", time.localtime(int(upload_time))),
|
|
|
|
- v_id,
|
|
|
|
- v_title,
|
|
|
|
- our_video_link,
|
|
|
|
- p_id,
|
|
|
|
- p_mid,
|
|
|
|
- hour_user_name,
|
|
|
|
- int(hour_video_duration) / 1000,
|
|
|
|
- time.strftime("%Y/%m/%d %H:%M:%S",
|
|
|
|
- time.localtime(int(hour_video_send_time) / 1000)),
|
|
|
|
- hour_play_cnt]]
|
|
|
|
- time.sleep(1)
|
|
|
|
- Feishu.update_values(log_type, "monitor", "N7e2yI", "F2:O2", values)
|
|
|
|
except Exception as e:
|
|
except Exception as e:
|
|
Common.logger(log_type).error("下载视频异常:{}", e)
|
|
Common.logger(log_type).error("下载视频异常:{}", e)
|
|
|
|
|
|
@@ -1097,33 +1062,12 @@ class HourList:
|
|
hour_video_url]]
|
|
hour_video_url]]
|
|
time.sleep(1)
|
|
time.sleep(1)
|
|
Feishu.update_values(log_type, "xiaoniangao", "yatRv2", "F2:W2", values)
|
|
Feishu.update_values(log_type, "xiaoniangao", "yatRv2", "F2:W2", values)
|
|
-
|
|
|
|
-
|
|
|
|
- Common.logger(log_type).info("添加视频到监控表:{}", v_title)
|
|
|
|
-
|
|
|
|
- time.sleep(1)
|
|
|
|
- Feishu.insert_columns(log_type, "monitor", "N7e2yI", "ROWS", 1, 2)
|
|
|
|
-
|
|
|
|
- values = [[time.strftime("%Y/%m/%d %H:%M:%S", time.localtime(int(upload_time))),
|
|
|
|
- v_id,
|
|
|
|
- v_title,
|
|
|
|
- our_video_link,
|
|
|
|
- p_id,
|
|
|
|
- p_mid,
|
|
|
|
- hour_user_name,
|
|
|
|
- int(hour_video_duration) / 1000,
|
|
|
|
- time.strftime("%Y/%m/%d %H:%M:%S",
|
|
|
|
- time.localtime(int(hour_video_send_time) / 1000)),
|
|
|
|
- hour_play_cnt]]
|
|
|
|
- time.sleep(1)
|
|
|
|
- Feishu.update_values(log_type, "monitor", "N7e2yI", "F2:O2", values)
|
|
|
|
except Exception as e:
|
|
except Exception as e:
|
|
Common.logger(log_type).error("下载视频异常:{}", e)
|
|
Common.logger(log_type).error("下载视频异常:{}", e)
|
|
elif int(ten_cnt) >= 2000 and int(fifteen_cnt) >= 2000:
|
|
elif int(ten_cnt) >= 2000 and int(fifteen_cnt) >= 2000:
|
|
Common.logger(log_type).info(
|
|
Common.logger(log_type).info(
|
|
"10:00 and 15:00 数据上升量:{} and {} >= 2000", ten_cnt, fifteen_cnt)
|
|
"10:00 and 15:00 数据上升量:{} and {} >= 2000", ten_cnt, fifteen_cnt)
|
|
Common.logger(log_type).info("满足下载规则,开始下载视频")
|
|
Common.logger(log_type).info("满足下载规则,开始下载视频")
|
|
-
|
|
|
|
try:
|
|
try:
|
|
url = "https://kapi.xiaoniangao.cn/profile/get_profile_by_id"
|
|
url = "https://kapi.xiaoniangao.cn/profile/get_profile_by_id"
|
|
headers = {
|
|
headers = {
|
|
@@ -1251,33 +1195,12 @@ class HourList:
|
|
hour_video_url]]
|
|
hour_video_url]]
|
|
time.sleep(1)
|
|
time.sleep(1)
|
|
Feishu.update_values(log_type, "xiaoniangao", "yatRv2", "F2:W2", values)
|
|
Feishu.update_values(log_type, "xiaoniangao", "yatRv2", "F2:W2", values)
|
|
-
|
|
|
|
-
|
|
|
|
- Common.logger(log_type).info("添加视频到监控表:{}", v_title)
|
|
|
|
-
|
|
|
|
- time.sleep(1)
|
|
|
|
- Feishu.insert_columns(log_type, "monitor", "N7e2yI", "ROWS", 1, 2)
|
|
|
|
-
|
|
|
|
- values = [[time.strftime("%Y/%m/%d %H:%M:%S", time.localtime(int(upload_time))),
|
|
|
|
- v_id,
|
|
|
|
- v_title,
|
|
|
|
- our_video_link,
|
|
|
|
- p_id,
|
|
|
|
- p_mid,
|
|
|
|
- hour_user_name,
|
|
|
|
- int(hour_video_duration) / 1000,
|
|
|
|
- time.strftime("%Y/%m/%d %H:%M:%S",
|
|
|
|
- time.localtime(int(hour_video_send_time) / 1000)),
|
|
|
|
- hour_play_cnt]]
|
|
|
|
- time.sleep(1)
|
|
|
|
- Feishu.update_values(log_type, "monitor", "N7e2yI", "F2:O2", values)
|
|
|
|
except Exception as e:
|
|
except Exception as e:
|
|
Common.logger(log_type).error("下载视频异常:{}", e)
|
|
Common.logger(log_type).error("下载视频异常:{}", e)
|
|
elif int(fifteen_cnt) >= 2000 and int(twenty_cnt) >= 2000:
|
|
elif int(fifteen_cnt) >= 2000 and int(twenty_cnt) >= 2000:
|
|
Common.logger(log_type).info(
|
|
Common.logger(log_type).info(
|
|
"15:00 and 20:00 数据上升量:{} and {} >= 2000", fifteen_cnt, twenty_cnt)
|
|
"15:00 and 20:00 数据上升量:{} and {} >= 2000", fifteen_cnt, twenty_cnt)
|
|
Common.logger(log_type).info("满足下载规则,开始下载视频")
|
|
Common.logger(log_type).info("满足下载规则,开始下载视频")
|
|
-
|
|
|
|
try:
|
|
try:
|
|
url = "https://kapi.xiaoniangao.cn/profile/get_profile_by_id"
|
|
url = "https://kapi.xiaoniangao.cn/profile/get_profile_by_id"
|
|
headers = {
|
|
headers = {
|
|
@@ -1405,33 +1328,12 @@ class HourList:
|
|
hour_video_url]]
|
|
hour_video_url]]
|
|
time.sleep(1)
|
|
time.sleep(1)
|
|
Feishu.update_values(log_type, "xiaoniangao", "yatRv2", "F2:W2", values)
|
|
Feishu.update_values(log_type, "xiaoniangao", "yatRv2", "F2:W2", values)
|
|
-
|
|
|
|
-
|
|
|
|
- Common.logger(log_type).info("添加视频到监控表:{}", v_title)
|
|
|
|
-
|
|
|
|
- time.sleep(1)
|
|
|
|
- Feishu.insert_columns(log_type, "monitor", "N7e2yI", "ROWS", 1, 2)
|
|
|
|
-
|
|
|
|
- values = [[time.strftime("%Y/%m/%d %H:%M:%S", time.localtime(int(upload_time))),
|
|
|
|
- v_id,
|
|
|
|
- v_title,
|
|
|
|
- our_video_link,
|
|
|
|
- p_id,
|
|
|
|
- p_mid,
|
|
|
|
- hour_user_name,
|
|
|
|
- int(hour_video_duration) / 1000,
|
|
|
|
- time.strftime("%Y/%m/%d %H:%M:%S",
|
|
|
|
- time.localtime(int(hour_video_send_time) / 1000)),
|
|
|
|
- hour_play_cnt]]
|
|
|
|
- time.sleep(1)
|
|
|
|
- Feishu.update_values(log_type, "monitor", "N7e2yI", "F2:O2", values)
|
|
|
|
except Exception as e:
|
|
except Exception as e:
|
|
Common.logger(log_type).error("下载视频异常:{}", e)
|
|
Common.logger(log_type).error("下载视频异常:{}", e)
|
|
elif int(yesterday_twenty_cnt) >= 2000 and int(ten_cnt) >= 2000:
|
|
elif int(yesterday_twenty_cnt) >= 2000 and int(ten_cnt) >= 2000:
|
|
Common.logger(log_type).info("昨日20:00 and 今日10:00 数据上升量:{} and {} >= 2000",
|
|
Common.logger(log_type).info("昨日20:00 and 今日10:00 数据上升量:{} and {} >= 2000",
|
|
yesterday_twenty_cnt, ten_cnt)
|
|
yesterday_twenty_cnt, ten_cnt)
|
|
Common.logger(log_type).info("满足下载规则,开始下载视频")
|
|
Common.logger(log_type).info("满足下载规则,开始下载视频")
|
|
-
|
|
|
|
try:
|
|
try:
|
|
url = "https://kapi.xiaoniangao.cn/profile/get_profile_by_id"
|
|
url = "https://kapi.xiaoniangao.cn/profile/get_profile_by_id"
|
|
headers = {
|
|
headers = {
|
|
@@ -1559,34 +1461,15 @@ class HourList:
|
|
hour_video_url]]
|
|
hour_video_url]]
|
|
time.sleep(1)
|
|
time.sleep(1)
|
|
Feishu.update_values(log_type, "xiaoniangao", "yatRv2", "F2:W2", values)
|
|
Feishu.update_values(log_type, "xiaoniangao", "yatRv2", "F2:W2", values)
|
|
-
|
|
|
|
-
|
|
|
|
- Common.logger(log_type).info("添加视频到监控表:{}", v_title)
|
|
|
|
-
|
|
|
|
- time.sleep(1)
|
|
|
|
- Feishu.insert_columns(log_type, "monitor", "N7e2yI", "ROWS", 1, 2)
|
|
|
|
-
|
|
|
|
- values = [[time.strftime("%Y/%m/%d %H:%M:%S", time.localtime(int(upload_time))),
|
|
|
|
- v_id,
|
|
|
|
- v_title,
|
|
|
|
- our_video_link,
|
|
|
|
- p_id,
|
|
|
|
- p_mid,
|
|
|
|
- hour_user_name,
|
|
|
|
- int(hour_video_duration) / 1000,
|
|
|
|
- time.strftime("%Y/%m/%d %H:%M:%S",
|
|
|
|
- time.localtime(int(hour_video_send_time) / 1000)),
|
|
|
|
- hour_play_cnt]]
|
|
|
|
- time.sleep(1)
|
|
|
|
- Feishu.update_values(log_type, "monitor", "N7e2yI", "F2:O2", values)
|
|
|
|
except Exception as e:
|
|
except Exception as e:
|
|
Common.logger(log_type).error("下载视频异常:{}", e)
|
|
Common.logger(log_type).error("下载视频异常:{}", e)
|
|
else:
|
|
else:
|
|
Common.logger(log_type).info("上升量不满足下载规则")
|
|
Common.logger(log_type).info("上升量不满足下载规则")
|
|
except Exception as e:
|
|
except Exception as e:
|
|
- Common.logger(log_type).error("下载视频时,获取飞书信息异常:{}", e)
|
|
+ Common.logger(log_type).error("下载视频时,获取飞书信息异常:{}\n", e)
|
|
|
|
|
|
|
|
|
|
if __name__ == "__main__":
|
|
if __name__ == "__main__":
|
|
HourList.get_hour_list_feeds("hour")
|
|
HourList.get_hour_list_feeds("hour")
|
|
-
|
|
+
|
|
|
|
+ pass
|