From d0ded6689c5719b8581d7678f802adabb9a971d6 Mon Sep 17 00:00:00 2001 From: Relakkes Date: Sun, 5 Nov 2023 15:27:18 +0800 Subject: [PATCH] feat: add article url for issue #63 --- models/douyin.py | 2 ++ models/xiaohongshu.py | 2 ++ 2 files changed, 4 insertions(+) diff --git a/models/douyin.py b/models/douyin.py index 2c14a4c..6181133 100644 --- a/models/douyin.py +++ b/models/douyin.py @@ -38,6 +38,7 @@ class DouyinAweme(DouyinBaseModel): comment_count = fields.CharField(null=True, max_length=16, description="视频评论数") share_count = fields.CharField(null=True, max_length=16, description="视频分享数") collected_count = fields.CharField(null=True, max_length=16, description="视频收藏数") + aweme_url = fields.CharField(null=True, max_length=255, description="视频详情页URL") class Meta: table = "douyin_aweme" @@ -85,6 +86,7 @@ async def update_douyin_aweme(aweme_item: Dict): "share_count": interact_info.get("share_count"), "ip_location": aweme_item.get("ip_label", ""), "last_modify_ts": utils.get_current_timestamp(), + "aweme_url": f"https://www.douyin.com/video/{aweme_id}" } print(f"douyin aweme id:{aweme_id}, title:{local_db_item.get('title')}") if config.IS_SAVED_DATABASED: diff --git a/models/xiaohongshu.py b/models/xiaohongshu.py index 6ed6f9f..a598948 100644 --- a/models/xiaohongshu.py +++ b/models/xiaohongshu.py @@ -36,6 +36,7 @@ class XHSNote(XhsBaseModel): comment_count = fields.CharField(null=True, max_length=16, description="笔记评论数") share_count = fields.CharField(null=True, max_length=16, description="笔记分享数") image_list = fields.TextField(null=True, description="笔记封面图片列表") + note_url = fields.CharField(null=True, max_length=255, description="笔记详情页的URL") class Meta: table = "xhs_note" @@ -83,6 +84,7 @@ async def update_xhs_note(note_item: Dict): "ip_location": note_item.get("ip_location", ""), "image_list": ','.join([img.get('url', '') for img in image_list]), "last_modify_ts": utils.get_current_timestamp(), + "note_url": f"https://www.xiaohongshu.com/explore/{note_id}" } print("xhs note:", local_db_item) if config.IS_SAVED_DATABASED: