Skip to content

Commit 794d6ec

Browse files
docs: Added README."en".md translation via https://github.com/dephraiim/translate-readme
1 parent bd5f9b5 commit 794d6ec

File tree

1 file changed

+125
-17
lines changed

1 file changed

+125
-17
lines changed

README.en.md

+125-17
Original file line numberDiff line numberDiff line change
@@ -3,40 +3,148 @@
33
<a href="https://github.com/TikHubIO/TikHub-API-Python-SDK/blob/main/README.en.md">English</a> | <a href="https://github.com/TikHubIO/TikHub-API-Python-SDK/blob/main/README.md">简体中文</a>
44
</div>
55

6-
#### Introduction
6+
#### **Introduction**
77

8-
[TikTok](https://tikhub.io/)It is an All in one RESTful API platform.
8+
🎉「[TikHub.io](https://tikhub.io/)"Is a**A platform for out-of-the-box integration tools and services**, our goal is to help users quickly start business and support function customization. Our vision is to form a community entrepreneurship project. A single tree cannot grow into a forest, but cooperation can lead to win-win results.**Every community member has the opportunity to integrate the functions or interfaces they write into our platform and benefit from them**. We have accumulated a large number of registered users and community users, and in order to realize this vision, we are actively planning and implementing cooperation strategies to ensure the sustainable and healthy development of the ecosystem. Welcome everyone to join us[Discord](https://discord.gg/aMEAS8Xsvz)Community.
99

10-
The API we provide can only obtain public data, that is, anyone can access Douyin, TikTok, and Xiaohongshu through browsers and APPs to obtain them.
10+
* * *
1111

12-
If you have any suggestions or needs, please contact us. More features are under development, so stay tuned!
12+
#### **quick start**
1313

14-
* * *
14+
[TikHub.io](https://tikhub.io/)Most of the APIs are RESTFUL, which means you only need to use basic HTTP requests to complete the call.
15+
16+
All APIs are written based on the OPenAPI specification, which means you can use our`openapi.json`Automatically generate any form of API documentation:
1517

16-
#### Authentication
18+
<https://api.tikhub.io/openapi.json>
1719

18-
The interface with 🔒 in the interface document needs to carry Token in the request header before it can be called.
20+
Of course, we have used Swagger UI by default to display our API documents. You can open the following link on the web page, then authenticate the API Token on the web page, then click on any endpoint and click`Try it out`You can test the endpoints you need. Most endpoints already carry default values ​​or demo values, which will better help you understand the required parameters of the call:
1921

20-
Calling these interfaces will use the remaining number of requests in your account!
22+
<https://api.tikhub.io>
2123

2224
* * *
2325

24-
#### Buy
26+
#### **Authentication**
27+
28+
> Introduction
29+
30+
The endpoints with the 🔒 icon in the interface document need to carry the API Token in the request header before they can be called. Calling these interfaces will use the remaining free quota or account balance in your account. At the same time, each endpoint will also be based on the email of the API Token owner. The address limits the request rate. Each endpoint has independent RPS (Requests per second). In most cases, users can request the same endpoint 5 times per second.
31+
32+
> Generate API Token
33+
34+
The steps to obtain API Token are also very simple, you only need to log in to our user backend[Stay tuned](https://tikhub.io/users/api_keys), then click on the left`API Keys`You can generate your own API Token, and at the same time, you can customize the permissions of the API Token (`Scopes`), you can also set the expiration date of the API Token (`Expire Date`), you can also manually temporarily close the API Token (`Status`)。
35+
36+
> Used on the API documentation web page
37+
38+
After you complete the above steps, you can copy your API Token, then return to our Swagger UI web page and click the green on the right side of the page`Authorize`, and then at the bottom of the pop-up window`Value`Paste the API Token in the input box to complete the authentication.
2539

26-
Website(🚧ing):[tikhub.io](https://tikhub.io/)
40+
> Used in HTTP requests
2741
28-
API Document:[api.tikhub.io](https://api.tikhub.io/)
42+
If you want to carry the API Token in the HTTP request, please read the format below carefully, and you need to carry an API Token in the request header.`Authorization`Field, below I will give an example of JSON as header:
2943

30-
Discord(Support):<https://discord.gg/kk23BGeYrJ>
44+
{
3145

32-
Github:<https://github.com/TikHubIO>
46+
"Authorization":"Bearer Your_API_Token"
3347

34-
48+
}
49+
50+
> Remark
51+
52+
Please do not share your API Token, as this may cause you to lose property and other problems. We strongly recommend using a different API Token for each of your projects, and don’t forget to check the corresponding box when creating the API Token.`Scopes`, otherwise you will encounter insufficient permissions when requesting.
3553

3654
* * *
3755

38-
#### announcement
56+
## **Use SDK**
57+
58+
- Install ours via PyPi[SDK](https://pypi.org/project/tikhub/)
59+
60+
```console
61+
pip install tikhub
62+
```
63+
64+
- Import SDK
65+
66+
```python
67+
from tikhub import Client
68+
```
69+
70+
- InitializeClient
71+
72+
```python
73+
client = Client(base_url="https://api.tikhub.io",
74+
api_key="YOUR_API_TOKEN",
75+
proxies=None,
76+
max_retries=3,
77+
max_connections=50,
78+
timeout=10,
79+
max_tasks=50)
80+
```
81+
82+
- Request user data example
83+
84+
```python
85+
# 请求用户信息 | Request user info
86+
user_info = await client.TikHubUser.get_user_info()
87+
print(user_info)
88+
89+
# 请求用户每日使用情况 | Request user daily usage
90+
user_daily_usage = await client.TikHubUser.get_user_daily_usage()
91+
print(user_daily_usage)
92+
93+
# 计算价格 | Calculate price
94+
price = await client.TikHubUser.calculate_price(endpoint="/api/v1/douyin/app/v1/fetch_one_video", request_per_day=100)
95+
print(price)
96+
97+
# 获取阶梯式折扣百分比信息 | Get tiered discount percentage information
98+
tiered_discount_info = await client.TikHubUser.get_tiered_discount_info()
99+
print(tiered_discount_info)
100+
101+
# 获取一个端点的信息 | Get information of an endpoint
102+
endpoint_info = await client.TikHubUser.get_endpoint_info(endpoint="/api/v1/douyin/app/v1/fetch_one_video")
103+
print(endpoint_info)
104+
105+
# 获取所有端点信息 | Get all endpoints information
106+
all_endpoints_info = await client.TikHubUser.get_all_endpoints_info()
107+
print(all_endpoints_info)
108+
```
109+
110+
- Available properties in Client
111+
112+
```python
113+
# TikHub
114+
self.TikHubUser = TikHubUser(self.client)
115+
116+
# Douyin
117+
self.DouyinWeb = DouyinWeb(self.client)
118+
self.DouyinAppV1 = DouyinAppV1(self.client)
119+
self.DouyinAppV2 = DouyinAppV2(self.client)
120+
self.DouyinAppV3 = DouyinAppV3(self.client)
121+
122+
# TikTok
123+
self.TikTokWeb = TikTokWeb(self.client)
124+
self.TikTokAppV2 = TikTokAppV2(self.client)
125+
self.TikTokAppV3 = TikTokAppV3(self.client)
126+
127+
# Instagram
128+
self.InstagramWeb = InstagramWeb(self.client)
129+
130+
# Weibo
131+
self.WeiboWeb = WeiboWeb(self.client)
132+
```
133+
134+
- use`DouyinAppV1`of`fetch_one_video`The method calls the interface to obtain single video data.
135+
136+
```python
137+
# 获取单个作品数据 | Get single video data
138+
video_data = await client.DouyinAppV1.fetch_one_video(aweme_id="7345492945006595379")
139+
print(video_data)
140+
```
141+
142+
- We have used HTTPX to asynchronously encapsulate most endpoints. If your code is executed synchronously, you can use the following code to prevent asynchronous infection.
39143

40-
TikHub’s API will use**Free plus paid**run in the form.
144+
```python
145+
# 使用asyncio.run防止异步传染到其他代码 | Use asyncio.run to prevent asynchronous infection to other code
146+
video_data = asyncio.run(client.DouyinAppV1.fetch_one_video(aweme_id="7345492945006595379"))
147+
print(video_data)
148+
```
41149

42-
After logging in, you can get 50-100 API requests randomly by checking in, and you can check in once every 24 hours.
150+
- Due to the limited chapters, the complete methods are not listed here. You can view the methods implemented in each attribute by viewing the source code, and the parameters accepted by each method have been added.`type hints`

0 commit comments

Comments
 (0)