Skip to content

Commit 0a5460d

Browse files
committed
Adapted to the new interface of API version V5.2.2
1 parent 5131a4c commit 0a5460d

File tree

6 files changed

+44
-1
lines changed

6 files changed

+44
-1
lines changed

dist/tikhub-1.12.8-py3-none-any.whl

68.3 KB
Binary file not shown.

dist/tikhub-1.12.8.tar.gz

46.5 KB
Binary file not shown.

tikhub/api/v1/endpoints/tiktok/app/tiktok_app_v2.py

+6
Original file line numberDiff line numberDiff line change
@@ -146,6 +146,12 @@ async def check_live_room_online(self, room_id: str):
146146
data = await self.client.fetch_get_json(f"{endpoint}?room_id={room_id}")
147147
return data
148148

149+
# 视频主页Feed (Home Feed) | Get video home feed
150+
async def fetch_home_feed(self):
151+
endpoint = "/api/v1/tiktok/app/v2/fetch_home_feed"
152+
data = await self.client.fetch_get_json(endpoint)
153+
return data
154+
149155

150156
if __name__ == "__main__":
151157
import asyncio

tikhub/api/v1/endpoints/tiktok/app/tiktok_app_v3.py

+6
Original file line numberDiff line numberDiff line change
@@ -256,6 +256,12 @@ async def fetch_user_music_list(self, sec_user_id: str, cursor: int, count: int)
256256
data = await self.client.fetch_get_json(f"{endpoint}?sec_user_id={sec_user_id}&cursor={cursor}&count={count}")
257257
return data
258258

259+
# 视频主页Feed (Home Feed) | Get video home feed
260+
async def fetch_home_feed(self):
261+
endpoint = "/api/v1/tiktok/app/v3/fetch_home_feed"
262+
data = await self.client.fetch_get_json(endpoint)
263+
return data
264+
259265

260266
if __name__ == "__main__":
261267
import asyncio

tikhub/api/v1/endpoints/twitter/web/twitter_web.py

+31
Original file line numberDiff line numberDiff line change
@@ -27,3 +27,34 @@ async def fetch_user_post_tweet(self, userId: str, count: int = 20, cursor: str
2727
endpoint = "/api/v1/twitter/web/fetch_user_post_tweet"
2828
data = await self.client.fetch_get_json(f"{endpoint}?userId={userId}&count={count}&cursor={cursor}")
2929
return data
30+
31+
# SearchTimeline | 搜索时间线
32+
async def fetch_search_timeline(self, rawQuery: str, count: int = 20, product: str = 'Top', cursor: str = None):
33+
endpoint = "/api/v1/twitter/web/fetch_search_timeline"
34+
data = await self.client.fetch_get_json(f"{endpoint}?rawQuery={rawQuery}&count={count}&product={product}&cursor={cursor}")
35+
return data
36+
37+
# Post Comments | 获取评论
38+
async def fetch_post_comments(self, tweetId: str, rankingModel: str = 'Relevance', cursor: str = None):
39+
endpoint = "/api/v1/twitter/web/fetch_post_comments"
40+
data = await self.client.fetch_get_json(f"{endpoint}?tweetId={tweetId}&rankingModel={rankingModel}&cursor={cursor}")
41+
return data
42+
43+
# Fetch user tweet replies | 获取用户推文回复
44+
async def fetch_user_tweet_replies(self, userId: str, count: int = 20, cursor: str = None):
45+
endpoint = "/api/v1/twitter/web/fetch_user_tweet_replies"
46+
data = await self.client.fetch_get_json(f"{endpoint}?userId={userId}&count={count}&cursor={cursor}")
47+
return data
48+
49+
# UserHighlightsTweets | 获取用户高光推文
50+
async def fetch_user_highlights_tweets(self, userId: str, count: int = 20, cursor: str = None):
51+
endpoint = "/api/v1/twitter/web/fetch_user_highlights_tweets"
52+
data = await self.client.fetch_get_json(f"{endpoint}?userId={userId}&count={count}&cursor={cursor}")
53+
return data
54+
55+
# UserMedia | 获取用户媒体
56+
async def fetch_user_media(self, userId: str, count: int = 20, cursor: str = None):
57+
endpoint = "/api/v1/twitter/web/fetch_user_media"
58+
data = await self.client.fetch_get_json(f"{endpoint}?userId={userId}&count={count}&cursor={cursor}")
59+
return data
60+

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.7"
2+
version = "1.12.8"

0 commit comments

Comments
 (0)