|
@@ -76,10 +76,6 @@ def get_feeds():
|
|
|
if "videoInfo" not in items[i]:
|
|
|
Common.logger().info("无视频信息")
|
|
|
else:
|
|
|
- # 获取视频ID
|
|
|
- video_id = items[i]["videoId"]
|
|
|
- Common.logger().info('视频ID:{}', video_id)
|
|
|
-
|
|
|
# 获取视频标题
|
|
|
video_title = items[i]["title"].strip().replace("\n", "")\
|
|
|
.replace("/", "").replace("\\", "").replace("\r", "")\
|
|
@@ -88,6 +84,10 @@ def get_feeds():
|
|
|
.replace(">", "").replace("|", "").replace(" ", "")\
|
|
|
.replace("&NBSP", "").replace(".", "。").replace(" ", "")
|
|
|
Common.logger().info('视频标题:{}', video_title)
|
|
|
+
|
|
|
+ # 获取视频ID
|
|
|
+ video_id = items[i]["videoId"]
|
|
|
+ Common.logger().info('视频ID:{}', video_id)
|
|
|
|
|
|
# 获取视频播放次数
|
|
|
video_play_cnt = items[i]["playCount"]
|
|
@@ -97,10 +97,6 @@ def get_feeds():
|
|
|
video_liked_cnt = items[i]["liked_cnt"]
|
|
|
Common.logger().info('视频点赞数:{}', video_liked_cnt)
|
|
|
|
|
|
- # 获取视频时长
|
|
|
- video_duration = items[i]["mediaDuration"]
|
|
|
- Common.logger().info('视频时长:{}秒', video_duration)
|
|
|
-
|
|
|
# 获取视频评论数
|
|
|
video_comment_cnt = items[i]["comment_cnt"]
|
|
|
Common.logger().info('视频评论数:{}', video_comment_cnt)
|
|
@@ -108,16 +104,11 @@ def get_feeds():
|
|
|
# 获取视频分享数
|
|
|
video_shared_cnt = items[i]["shared_cnt"]
|
|
|
Common.logger().info('视频分享数:{}', video_shared_cnt)
|
|
|
-
|
|
|
- # 获取视频发布时间
|
|
|
- video_send_date = items[i]["date"]
|
|
|
- Common.logger().info("视频发布时间:{}",
|
|
|
- time.strftime("%Y-%m-%d %H:%M:%S", time.localtime(video_send_date)))
|
|
|
-
|
|
|
- # 获取视频用户名
|
|
|
- video_user = items[i]["source"].strip().replace("\n", "")
|
|
|
- Common.logger().info('视频用户名:{}', video_user)
|
|
|
-
|
|
|
+
|
|
|
+ # 获取视频时长
|
|
|
+ video_duration = items[i]["mediaDuration"]
|
|
|
+ Common.logger().info('视频时长:{}秒', video_duration)
|
|
|
+
|
|
|
# 获取视频宽高
|
|
|
if "short_video_info" not in items[i]:
|
|
|
video_width = "0"
|
|
@@ -138,6 +129,15 @@ def get_feeds():
|
|
|
video_resolution = str(video_width) + "*" + str(video_height)
|
|
|
Common.logger().info('视频宽高:{}', video_resolution)
|
|
|
|
|
|
+ # 获取视频发布时间
|
|
|
+ video_send_date = items[i]["date"]
|
|
|
+ Common.logger().info("视频发布时间:{}",
|
|
|
+ time.strftime("%Y-%m-%d %H:%M:%S", time.localtime(video_send_date)))
|
|
|
+
|
|
|
+ # 获取视频用户名
|
|
|
+ video_user = items[i]["source"].strip().replace("\n", "")
|
|
|
+ Common.logger().info('视频用户名:{}', video_user)
|
|
|
+
|
|
|
# 获取视频用户头像
|
|
|
video_user_cover = items[i]["bizIcon"]
|
|
|
Common.logger().info('视频用户头像:{}', video_user_cover)
|
|
@@ -179,43 +179,39 @@ def get_feeds():
|
|
|
or video_cover == "" \
|
|
|
or url == "":
|
|
|
Common.logger().info("无效视频")
|
|
|
+ # 从 云文档 去重:https://w42nne6hzg.feishu.cn/sheets/shtcngRPoDYAi24x52j2nDuHMih?sheet=20ce0c
|
|
|
+ elif video_id in [j for i in Feishu.get_values_batch("20ce0c") for j in i]:
|
|
|
+ Common.logger().info("该视频已下载:{}", video_title)
|
|
|
+ # 从 云文档 去重:https://w42nne6hzg.feishu.cn/sheets/shtcngRPoDYAi24x52j2nDuHMih?sheet=SdCHOM
|
|
|
+ elif video_id in [j for i in Feishu.get_values_batch("SdCHOM") for j in i]:
|
|
|
+ Common.logger().info("该视频已在kanyikan_feeds中:{}", video_title)
|
|
|
else:
|
|
|
- # 从 云文档 去重:https://w42nne6hzg.feishu.cn/sheets/shtcngRPoDYAi24x52j2nDuHMih?sheet=20ce0c
|
|
|
- if video_id in [j for i in Feishu.get_values_batch("20ce0c") for j in i]:
|
|
|
- Common.logger().info("该视频已下载:{}", video_title)
|
|
|
- else:
|
|
|
- Common.logger().info("该视频未下载:{}", video_title)
|
|
|
-
|
|
|
- # 从 云文档 去重:https://w42nne6hzg.feishu.cn/sheets/shtcngRPoDYAi24x52j2nDuHMih?sheet=SdCHOM
|
|
|
- if video_id in [j for i in Feishu.get_values_batch("SdCHOM") for j in i]:
|
|
|
- Common.logger().info("该视频已在kanyikan_feeds_1中:{}", video_title)
|
|
|
- else:
|
|
|
- Common.logger().info("添加该视频信息至kanyikan_feeds_1:{}", video_title)
|
|
|
+ Common.logger().info("该视频未下载,添加至kanyikan_feeds:{}", video_title)
|
|
|
|
|
|
- # 看一看+工作表,插入首行
|
|
|
- print(Feishu.insert_columns("SdCHOM"))
|
|
|
+ # 看一看+工作表,插入首行
|
|
|
+ Feishu.insert_columns("SdCHOM")
|
|
|
|
|
|
- # 获取当前时间
|
|
|
- get_feeds_time = int(time.time())
|
|
|
- # 看一看云文档,工作表 kanyikan_feeds_1 中写入数据
|
|
|
- Feishu.update_values("SdCHOM",
|
|
|
- a1=str(get_feeds_time),
|
|
|
- b1=str(video_id),
|
|
|
- c1=str(video_play_cnt),
|
|
|
- d1=str(video_title),
|
|
|
- e1=str(video_duration),
|
|
|
- f1=str(video_comment_cnt),
|
|
|
- g1=str(video_liked_cnt),
|
|
|
- h1=str(video_shared_cnt),
|
|
|
- i1=str(video_resolution),
|
|
|
- j1=str(video_send_date),
|
|
|
- k1=str(video_user),
|
|
|
- l1=str(video_user_cover),
|
|
|
- m1=str(video_cover),
|
|
|
- n1=str(url),
|
|
|
- o1=str(video_list_session))
|
|
|
+ # 获取当前时间
|
|
|
+ get_feeds_time = int(time.time())
|
|
|
+ # 看一看云文档,工作表 kanyikan_feeds 中写入数据
|
|
|
+ Feishu.update_values("SdCHOM",
|
|
|
+ a1=str(get_feeds_time),
|
|
|
+ b1=str(video_id),
|
|
|
+ c1=str(video_play_cnt),
|
|
|
+ d1=str(video_title),
|
|
|
+ e1=str(video_duration),
|
|
|
+ f1=str(video_comment_cnt),
|
|
|
+ g1=str(video_liked_cnt),
|
|
|
+ h1=str(video_shared_cnt),
|
|
|
+ i1=str(video_resolution),
|
|
|
+ j1=str(video_send_date),
|
|
|
+ k1=str(video_user),
|
|
|
+ l1=str(video_user_cover),
|
|
|
+ m1=str(video_cover),
|
|
|
+ n1=str(url),
|
|
|
+ o1=str(video_list_session))
|
|
|
except Exception as e:
|
|
|
- Common.logger().exception("获取视频 list 时异常:{}", e)
|
|
|
+ Common.logger().error("获取视频 list 时异常:{}", e)
|
|
|
|
|
|
|
|
|
if __name__ == "__main__":
|