Skip to content

Commit ff7c09f

Browse files
committed
Upgraded SDK V1.10.9 Support Xigua Video API
1 parent e2384c0 commit ff7c09f

File tree

7 files changed

+63
-1
lines changed

7 files changed

+63
-1
lines changed

Diff for: dist/tikhub-1.10.9-py3-none-any.whl

57.5 KB
Binary file not shown.

Diff for: dist/tikhub-1.10.9.tar.gz

38.1 KB
Binary file not shown.

Diff for: setup.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@
1313

1414
setup(
1515
name="tikhub",
16-
version="1.10.8",
16+
version="1.10.9",
1717
author="TikHub.io",
1818
author_email="[email protected]",
1919
description="A Python SDK for TikHub RESTful API",

Diff for: tikhub/api/v1/endpoints/douyin/app/douyin_app_v3.py

+6
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,12 @@ async def fetch_one_video_by_share_url(self, share_url: str):
2424
data = await self.client.fetch_get_json(f"{endpoint}?share_url={share_url}")
2525
return data
2626

27+
# 根据视频ID获取作品的统计数据 | Get the statistical data of the work according to the video ID
28+
async def fetch_video_statistics(self, aweme_ids: str):
29+
endpoint = "/api/v1/douyin/app/v3/fetch_video_statistics"
30+
data = await self.client.fetch_get_json(f"{endpoint}?aweme_ids={aweme_ids}")
31+
return data
32+
2733
# 获取指定用户的信息
2834
async def handler_user_profile(self, sec_user_id: str):
2935
endpoint = f"/api/v1/douyin/app/v3/handler_user_profile"

Diff for: tikhub/api/v1/endpoints/xigua/__init__.py

Whitespace-only changes.

Diff for: tikhub/api/v1/endpoints/xigua/app/__init__.py

Whitespace-only changes.

Diff for: tikhub/api/v1/endpoints/xigua/app/xigua_app_v2.py

+56
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,56 @@
1+
# 导入API SDK Client类
2+
3+
from tikhub.http_client.api_client import APIClient
4+
5+
# 标记已废弃的方法
6+
from tikhub.http_client.deprecated import deprecated
7+
8+
9+
class XiguaAppV2:
10+
11+
# 初始化 | Initialize
12+
def __init__(self, client: APIClient):
13+
self.client = client
14+
15+
# 获取单个作品数据 | Get single video data
16+
async def fetch_one_video(self, item_id: str):
17+
endpoint = f"/api/v1/xigua/app/v2/fetch_one_video"
18+
data = await self.client.fetch_get_json(f"{endpoint}?item_id={item_id}")
19+
return data
20+
21+
# 视频评论列表 | Video comment list
22+
async def fetch_video_comment_list(self, item_id: str, offset: int = 0, count: int = 20):
23+
endpoint = f"/api/v1/xigua/app/v2/fetch_video_comment_list"
24+
data = await self.client.fetch_get_json(f"{endpoint}?item_id={item_id}&offset={offset}&count={count}")
25+
return data
26+
27+
# 搜索视频 | Search video
28+
async def search_video(self, keyword: str, offset: int = 0, order_type: str = None, min_duration: int = None, max_duration: int = None):
29+
endpoint = f"/api/v1/xigua/app/v2/search_video"
30+
data = await self.client.fetch_get_json(f"{endpoint}?keyword={keyword}&offset={offset}&order_type={order_type}&min_duration={min_duration}&max_duration={max_duration}")
31+
return data
32+
33+
# 个人信息 | Personal information
34+
async def fetch_user_info(self, user_id: str):
35+
endpoint = f"/api/v1/xigua/app/v2/fetch_user_info"
36+
data = await self.client.fetch_get_json(f"{endpoint}?user_id={user_id}")
37+
return data
38+
39+
# 获取个人作品列表 | Get user post list
40+
async def fetch_user_post_list(self, user_id: str, max_behot_time: str = None):
41+
endpoint = f"/api/v1/xigua/app/v2/fetch_user_post_list"
42+
data = await self.client.fetch_get_json(f"{endpoint}?user_id={user_id}&max_behot_time={max_behot_time}")
43+
return data
44+
45+
46+
if __name__ == "__main__":
47+
import asyncio
48+
49+
50+
async def main():
51+
client = APIClient(base_url="http://127.0.0.1:8000", client_headers={
52+
"Authorization": "Bearer l7sVQFh64V8ltC8fzEaNtWE60zVSopDLlpVX62fArT1FznsPds9+2RGoXw=="})
53+
54+
xigua_app_v2 = XiguaAppV2(client)
55+
56+
asyncio.run(main())

0 commit comments

Comments
 (0)