Skip to content

Commit 72dd683

Browse files
committedSep 9, 2024
Adapted to the new interface of API version V5.2.1
1 parent bf0229c commit 72dd683

File tree

6 files changed

+38
-1
lines changed

6 files changed

+38
-1
lines changed
 

‎dist/tikhub-1.12.7-py3-none-any.whl

67.9 KB
Binary file not shown.

‎dist/tikhub-1.12.7.tar.gz

46.2 KB
Binary file not shown.

‎tikhub/api/v1/endpoints/douyin/web/douyin_web.py

+25
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,31 @@ async def fetch_one_video(self, aweme_id: str):
2323
data = await self.client.fetch_get_json(f"{endpoint}?aweme_id={aweme_id}")
2424
return data
2525

26+
# 获取单个作品数据V2 | Get single video data V2
27+
async def fetch_one_video_v2(self, aweme_id: str):
28+
"""
29+
获取单个作品数据 | Get single video data
30+
:param aweme_id: 作品id | Video id
31+
:return: 作品数据 | Video data
32+
"""
33+
endpoint = "/api/v1/douyin/web/fetch_one_video_v2"
34+
data = await self.client.fetch_get_json(f"{endpoint}?aweme_id={aweme_id}")
35+
return data
36+
37+
# 获取相关作品推荐数据 | Get related video recommendation data
38+
async def fetch_related_posts(self, aweme_id: str, refresh_index: int = 1, count: int = 20):
39+
"""
40+
获取相关作品推荐数据 | Get related video recommendation data
41+
:param aweme_id: 作品id | Video id
42+
:param refresh_index: 刷新索引 | Refresh index
43+
:param count: 数量 | Number
44+
:return: 相关作品推荐数据 | Related video recommendation data
45+
"""
46+
endpoint = "/api/v1/douyin/web/fetch_related_posts"
47+
data = await self.client.fetch_get_json(
48+
f"{endpoint}?aweme_id={aweme_id}&refresh_index={refresh_index}&count={count}")
49+
return data
50+
2651
# 获取单个作品视频弹幕数据 | Get single video danmaku data
2752
async def fetch_one_video_danmaku(self, item_id: str, duration: int, end_time: int, start_time: int):
2853
"""

‎tikhub/api/v1/endpoints/tiktok/web/tiktok_web.py

+6
Original file line numberDiff line numberDiff line change
@@ -222,6 +222,12 @@ async def fetch_tiktok_live_data(self, live_room_url: str):
222222
data = await self.client.fetch_get_json(f"{endpoint}?live_room_url={live_room_url}")
223223
return data
224224

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

226232
if __name__ == "__main__":
227233
import asyncio

‎tikhub/api/v1/endpoints/xiaohongshu/web/xiaohongshu_web.py

+6
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,12 @@ async def get_note_info(self, note_id: str):
1414
data = await self.client.fetch_get_json(f"{endpoint}?note_id={note_id}")
1515
return data
1616

17+
# 获取笔记信息 V2
18+
async def get_note_info_v2(self, note_id: str):
19+
endpoint = "/api/v1/xiaohongshu/web/get_note_info_v2"
20+
data = await self.client.fetch_get_json(f"{endpoint}?note_id={note_id}")
21+
return data
22+
1723
# 获取用户信息
1824
async def get_user_info(self, user_id: str):
1925
endpoint = "/api/v1/xiaohongshu/web/get_user_info"

‎tikhub/version.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,2 +1,2 @@
11
# tikhub/version.py
2-
version = "1.12.6"
2+
version = "1.12.7"

0 commit comments

Comments
 (0)
Please sign in to comment.