Skip to content

Commit

Permalink
Adapted to the new interface of API version V5.2.1
Browse files Browse the repository at this point in the history
  • Loading branch information
Evil0ctal committed Sep 9, 2024
1 parent bf0229c commit 72dd683
Show file tree
Hide file tree
Showing 6 changed files with 38 additions and 1 deletion.
Binary file added dist/tikhub-1.12.7-py3-none-any.whl
Binary file not shown.
Binary file added dist/tikhub-1.12.7.tar.gz
Binary file not shown.
25 changes: 25 additions & 0 deletions tikhub/api/v1/endpoints/douyin/web/douyin_web.py
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,31 @@ async def fetch_one_video(self, aweme_id: str):
data = await self.client.fetch_get_json(f"{endpoint}?aweme_id={aweme_id}")
return data

# 获取单个作品数据V2 | Get single video data V2
async def fetch_one_video_v2(self, aweme_id: str):
"""
获取单个作品数据 | Get single video data
:param aweme_id: 作品id | Video id
:return: 作品数据 | Video data
"""
endpoint = "/api/v1/douyin/web/fetch_one_video_v2"
data = await self.client.fetch_get_json(f"{endpoint}?aweme_id={aweme_id}")
return data

# 获取相关作品推荐数据 | Get related video recommendation data
async def fetch_related_posts(self, aweme_id: str, refresh_index: int = 1, count: int = 20):
"""
获取相关作品推荐数据 | Get related video recommendation data
:param aweme_id: 作品id | Video id
:param refresh_index: 刷新索引 | Refresh index
:param count: 数量 | Number
:return: 相关作品推荐数据 | Related video recommendation data
"""
endpoint = "/api/v1/douyin/web/fetch_related_posts"
data = await self.client.fetch_get_json(
f"{endpoint}?aweme_id={aweme_id}&refresh_index={refresh_index}&count={count}")
return data

# 获取单个作品视频弹幕数据 | Get single video danmaku data
async def fetch_one_video_danmaku(self, item_id: str, duration: int, end_time: int, start_time: int):
"""
Expand Down
6 changes: 6 additions & 0 deletions tikhub/api/v1/endpoints/tiktok/web/tiktok_web.py
Original file line number Diff line number Diff line change
Expand Up @@ -222,6 +222,12 @@ async def fetch_tiktok_live_data(self, live_room_url: str):
data = await self.client.fetch_get_json(f"{endpoint}?live_room_url={live_room_url}")
return data

# 获取直播间首页推荐列表 | Get live room home page recommendation list
async def fetch_live_recommend(self, related_live_tag: str):
endpoint = "/api/v1/tiktok/web/fetch_live_recommend"
data = await self.client.fetch_get_json(f"{endpoint}?related_live_tag={related_live_tag}")
return data


if __name__ == "__main__":
import asyncio
Expand Down
6 changes: 6 additions & 0 deletions tikhub/api/v1/endpoints/xiaohongshu/web/xiaohongshu_web.py
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,12 @@ async def get_note_info(self, note_id: str):
data = await self.client.fetch_get_json(f"{endpoint}?note_id={note_id}")
return data

# 获取笔记信息 V2
async def get_note_info_v2(self, note_id: str):
endpoint = "/api/v1/xiaohongshu/web/get_note_info_v2"
data = await self.client.fetch_get_json(f"{endpoint}?note_id={note_id}")
return data

# 获取用户信息
async def get_user_info(self, user_id: str):
endpoint = "/api/v1/xiaohongshu/web/get_user_info"
Expand Down
2 changes: 1 addition & 1 deletion tikhub/version.py
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
# tikhub/version.py
version = "1.12.6"
version = "1.12.7"

0 comments on commit 72dd683

Please sign in to comment.