Skip to content

Commit 0d676f5

Browse files
author
Anonymous Committer
committed
feat: init
0 parents  commit 0d676f5

26 files changed

+1169
-0
lines changed

.gitignore

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
__pycache__/
2+
*.pyc
3+
*.log
4+
*.egg-info/
5+
dist/
6+
build/
7+
.venv/

LICENSE

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
MIT License
2+
3+
Copyright (c) [year] [fullname]
4+
5+
Permission is hereby granted, free of charge, to any person obtaining a copy
6+
of this software and associated documentation files (the "Software"), to deal
7+
in the Software without restriction, including without limitation the rights
8+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9+
copies of the Software, and to permit persons to whom the Software is
10+
furnished to do so, subject to the following conditions:
11+
12+
The above copyright notice and this permission notice shall be included in all
13+
copies or substantial portions of the Software.
14+
15+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21+
SOFTWARE.

README.md

Lines changed: 92 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,92 @@
1+
# Just One API - Python SDK
2+
3+
Official Python SDK for accessing [Just One API](https://justoneapi.com) — a unified data service platform offering structured data from Social, E-commerce platforms such as Xiaohongshu, Taobao, Douyin, Kuaishou, Bilibili, and Weibo.
4+
5+
This SDK simplifies API integration and request signing, allowing developers to easily retrieve platform-specific data with minimal setup.
6+
7+
---
8+
9+
## 🚀 Installation
10+
11+
Install via PyPI:
12+
13+
```bash
14+
pip install justoneapi
15+
```
16+
17+
---
18+
19+
## 🛠 Quick Start
20+
21+
```python
22+
from justoneapi.client import JustOneAPIClient
23+
24+
client = JustOneAPIClient(token="your_token")
25+
26+
# Example: Get Douyin Video detail
27+
result, data, message = client.douyin.get_video_detail_v2(video_id="7428906452091145483")
28+
print(result)
29+
print(data)
30+
print(message)
31+
32+
# Example: Douyin Video Search
33+
result, data, message, has_next_page = client.douyin.search_video_v4(keyword="deepseek", sort_type="_0", publish_time="_0", duration="_0", page=1)
34+
print(result)
35+
print(data)
36+
print(message)
37+
print(has_next_page)
38+
```
39+
40+
### 📦 Return Value Description
41+
42+
Each API method returns one or more of the following values:
43+
44+
| Variable | Type | Description |
45+
|------------------|----------|-------------|
46+
| `result` | `bool` | Whether the request was successful. `True` means success, `False` means failure. |
47+
| `data` | `dict` / `list` | The actual data returned from the API. Structure varies by endpoint. |
48+
| `message` | `str` | Message from the server. Contains error info when request fails. |
49+
| `has_next_page` | `bool` | Present in paginated APIs. Indicates whether more data is available. |
50+
51+
---
52+
53+
## 🔐 Authentication
54+
55+
All API requests require a valid API token.
56+
You can obtain your token by contact us:
57+
👉 [Contact](https://justoneapi.com/contact)
58+
59+
---
60+
61+
## 📚 Documentation
62+
63+
👉 Full API docs: [https://justoneapi.com/docs](https://doc.justoneapi.com)
64+
65+
Includes:
66+
- Request parameters
67+
- Response fields
68+
- Error codes
69+
70+
---
71+
72+
## 🏠 Official Website
73+
74+
👉 [https://justoneapi.com](https://justoneapi.com)
75+
76+
Learn more about the project, data sources, and commercial integration opportunities.
77+
78+
---
79+
80+
## 📬 Contact Us
81+
82+
If you have any questions, feedback, or partnership inquiries:
83+
84+
- Email: **justoneapi@gmail.com**
85+
- Telegram: [@justoneapi](https://t.me/justoneapi)
86+
87+
---
88+
89+
## 🪪 License
90+
91+
This project is licensed under the MIT License.
92+
See the [LICENSE](./LICENSE) file for details.

justoneapi/__init__.py

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
__version__ = "1.0.0"
2+

justoneapi/apis/__init__.py

Whitespace-only changes.

justoneapi/apis/bilibili.py

Lines changed: 82 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,82 @@
1+
from justoneapi import config
2+
from justoneapi.apis import request_util
3+
from justoneapi.log import logger
4+
5+
6+
class BilibiliAPI:
7+
def __init__(self, token):
8+
self.token = token
9+
10+
def get_video_detail_v2(self, bvid: str):
11+
url = f"{config.BASE_URL}/api/bilibili/get-video-detail/v2"
12+
params = {
13+
"token": self.token,
14+
"bvid": bvid,
15+
}
16+
return request_util.get_request(url, params)
17+
18+
def get_user_video_list_v2(self, uid: str, aid: str = None):
19+
url = f"{config.BASE_URL}/api/bilibili/get-user-video-list/v2"
20+
params = {
21+
"token": self.token,
22+
"uid": uid,
23+
}
24+
if aid:
25+
params["aid"] = aid
26+
27+
has_next_page = False
28+
result, data, message = request_util.get_request_page(url, params)
29+
try:
30+
if data:
31+
if data.get("data", {}).get("has_next", False) is True:
32+
has_next_page = True
33+
except Exception as e:
34+
logger.warning(f"Pagination parse error at {url}. Contact us to fix it.")
35+
return result, data, message, has_next_page
36+
37+
def get_user_detail_v2(self, uid: str):
38+
url = f"{config.BASE_URL}/api/bilibili/get-user-detail/v2"
39+
params = {
40+
"token": self.token,
41+
"uid": uid,
42+
}
43+
return request_util.get_request(url, params)
44+
45+
def get_video_comment_v2(self, aid: str, cursor: str = None):
46+
url = f"{config.BASE_URL}/api/bilibili/get-video-comment/v2"
47+
params = {
48+
"token": self.token,
49+
"aid": aid,
50+
}
51+
if cursor:
52+
params["cursor"] = cursor
53+
54+
has_next_page = False
55+
result, data, message = request_util.get_request_page(url, params)
56+
try:
57+
if data:
58+
if data.get("data", {}).get("has_next", False) is True:
59+
has_next_page = True
60+
except Exception as e:
61+
logger.warning(f"Pagination parse error at {url}. Contact us to fix it.")
62+
return result, data, message, has_next_page
63+
64+
def search_video_v2(self, keyword: str, page: int):
65+
url = f"{config.BASE_URL}/api/bilibili/search-video/v2"
66+
params = {
67+
"token": self.token,
68+
"keyword": keyword,
69+
"page": page,
70+
}
71+
72+
has_next_page = False
73+
result, data, message = request_util.get_request_page(url, params)
74+
try:
75+
if data:
76+
if data.get("data", {}).get("result"):
77+
if page < data.get("data", {}).get("numPages", 0):
78+
has_next_page = True
79+
except Exception as e:
80+
logger.warning(f"Pagination parse error at {url}. Contact us to fix it.")
81+
return result, data, message, has_next_page
82+

justoneapi/apis/douyin.py

Lines changed: 121 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,121 @@
1+
from justoneapi import config
2+
from justoneapi.apis import request_util
3+
from justoneapi.log import logger
4+
5+
6+
class DouyinAPI:
7+
def __init__(self, token):
8+
self.token = token
9+
10+
def get_user_detail_v3(self, sec_uid: str):
11+
url = f"{config.BASE_URL}/api/douyin/get-user-detail/v3"
12+
params = {
13+
"token": self.token,
14+
"secUid": sec_uid,
15+
}
16+
return request_util.get_request(url, params)
17+
18+
def get_user_video_list_v3(self, sec_uid: str, max_cursor: int):
19+
url = f"{config.BASE_URL}/api/douyin/get-user-video-list/v3"
20+
params = {
21+
"token": self.token,
22+
"secUid": sec_uid,
23+
"maxCursor": max_cursor,
24+
}
25+
26+
has_next_page = False
27+
result, data, message = request_util.get_request_page(url, params)
28+
try:
29+
if data:
30+
if data.get("has_more") == 1:
31+
has_next_page = True
32+
except Exception as e:
33+
logger.warning(f"Pagination parse error at {url}. Contact us to fix it.")
34+
return result, data, message, has_next_page
35+
36+
def get_video_detail_v2(self, video_id: str):
37+
url = f"{config.BASE_URL}/api/douyin/get-video-detail/v2"
38+
params = {
39+
"token": self.token,
40+
"videoId": video_id,
41+
}
42+
return request_util.get_request(url, params)
43+
44+
def search_video_v4(self, keyword: str, sort_type: str, publish_time: str, duration: str, page: int, search_id: str = None):
45+
url = f"{config.BASE_URL}/api/douyin/search-video/v4"
46+
params = {
47+
"token": self.token,
48+
"keyword": keyword,
49+
"sortType": sort_type,
50+
"publishTime": publish_time,
51+
"duration": duration,
52+
"page": page,
53+
}
54+
if search_id:
55+
params["searchId"] = search_id
56+
57+
has_next_page = False
58+
result, data, message = request_util.get_request_page(url, params)
59+
try:
60+
if data:
61+
if data.get("business_config", {}).get("has_more", 0) == 1:
62+
has_next_page = True
63+
except Exception as e:
64+
logger.warning(f"Pagination parse error at {url}. Contact us to fix it.")
65+
return result, data, message, has_next_page
66+
67+
def search_user_v2(self, keyword: str, page: int, user_type: str = None):
68+
url = f"{config.BASE_URL}/api/douyin/search-user/v2"
69+
params = {
70+
"token": self.token,
71+
"keyword": keyword,
72+
"page": page,
73+
}
74+
if user_type:
75+
params["userType"] = user_type
76+
77+
has_next_page = False
78+
result, data, message = request_util.get_request_page(url, params)
79+
try:
80+
if data:
81+
if data.get("business_config", {}).get("has_more", 0) == 1:
82+
has_next_page = True
83+
except Exception as e:
84+
logger.warning(f"Pagination parse error at {url}. Contact us to fix it.")
85+
return result, data, message, has_next_page
86+
87+
def get_video_comment_v1(self, aweme_id: str, page: int):
88+
url = f"{config.BASE_URL}/api/douyin/get-video-comment/v1"
89+
params = {
90+
"token": self.token,
91+
"awemeId": aweme_id,
92+
"page": page,
93+
}
94+
95+
has_next_page = False
96+
result, data, message = request_util.get_request_page(url, params)
97+
try:
98+
if data:
99+
if data.get("has_more") == 1:
100+
has_next_page = True
101+
except Exception as e:
102+
logger.warning(f"Pagination parse error at {url}. Contact us to fix it.")
103+
return result, data, message, has_next_page
104+
105+
def get_video_sub_comment_v1(self, comment_id: str, page: int):
106+
url = f"{config.BASE_URL}/api/douyin/get-video-sub-comment/v1"
107+
params = {
108+
"token": self.token,
109+
"commentId": comment_id,
110+
"page": page,
111+
}
112+
113+
has_next_page = False
114+
result, data, message = request_util.get_request_page(url, params)
115+
try:
116+
if data:
117+
if data.get("has_more") == 1:
118+
has_next_page = True
119+
except Exception as e:
120+
logger.warning(f"Pagination parse error at {url}. Contact us to fix it.")
121+
return result, data, message, has_next_page

0 commit comments

Comments
 (0)