saverapi-client 1.0.3__tar.gz → 1.1.0__tar.gz
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- saverapi_client-1.1.0/LICENSE +21 -0
- saverapi_client-1.1.0/PKG-INFO +269 -0
- saverapi_client-1.1.0/README.md +225 -0
- saverapi_client-1.1.0/pyproject.toml +72 -0
- saverapi_client-1.1.0/saverapi/__init__.py +38 -0
- saverapi_client-1.1.0/saverapi/_version.py +1 -0
- saverapi_client-1.1.0/saverapi/async_client.py +139 -0
- saverapi_client-1.1.0/saverapi/cli.py +85 -0
- saverapi_client-1.1.0/saverapi/client.py +268 -0
- saverapi_client-1.1.0/saverapi/exceptions.py +65 -0
- saverapi_client-1.1.0/saverapi/py.typed +0 -0
- saverapi_client-1.1.0/saverapi_client.egg-info/PKG-INFO +269 -0
- {saverapi_client-1.0.3 → saverapi_client-1.1.0}/saverapi_client.egg-info/SOURCES.txt +9 -2
- saverapi_client-1.1.0/saverapi_client.egg-info/entry_points.txt +2 -0
- saverapi_client-1.1.0/saverapi_client.egg-info/requires.txt +4 -0
- {saverapi_client-1.0.3 → saverapi_client-1.1.0}/setup.cfg +4 -4
- saverapi_client-1.1.0/tests/test_client.py +145 -0
- saverapi_client-1.0.3/PKG-INFO +0 -435
- saverapi_client-1.0.3/README.md +0 -408
- saverapi_client-1.0.3/pyproject.toml +0 -81
- saverapi_client-1.0.3/saverapi/__init__.py +0 -4
- saverapi_client-1.0.3/saverapi/client.py +0 -165
- saverapi_client-1.0.3/saverapi_client.egg-info/PKG-INFO +0 -435
- saverapi_client-1.0.3/saverapi_client.egg-info/requires.txt +0 -1
- {saverapi_client-1.0.3 → saverapi_client-1.1.0}/saverapi_client.egg-info/dependency_links.txt +0 -0
- {saverapi_client-1.0.3 → saverapi_client-1.1.0}/saverapi_client.egg-info/top_level.txt +0 -0
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
MIT License
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2025-2026 SaverAPI.NET
|
|
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.
|
|
@@ -0,0 +1,269 @@
|
|
|
1
|
+
Metadata-Version: 2.4
|
|
2
|
+
Name: saverapi-client
|
|
3
|
+
Version: 1.1.0
|
|
4
|
+
Summary: Official Python SDK for SaverAPI.NET — social media downloader API for Instagram, TikTok, YouTube, Facebook, X, Pinterest, Threads, Vimeo, plus Shazam, music search and NSFW scan. Sync, async and CLI.
|
|
5
|
+
Author-email: "SaverAPI.NET" <saverapinet@gmail.com>
|
|
6
|
+
License: MIT
|
|
7
|
+
Project-URL: Homepage, https://saverapi.net
|
|
8
|
+
Project-URL: Documentation, https://saverapi.net/docs
|
|
9
|
+
Project-URL: API catalog, https://saverapi.net/all-in-one-downloader-api
|
|
10
|
+
Project-URL: YouTube Downloader API, https://saverapi.net/youtube-downloader-api
|
|
11
|
+
Project-URL: Instagram Downloader API, https://saverapi.net/instagram-downloader-api
|
|
12
|
+
Project-URL: TikTok Downloader API, https://saverapi.net/tiktok-downloader-api
|
|
13
|
+
Project-URL: Tutorials, https://saverapi.net/blog
|
|
14
|
+
Project-URL: Pricing, https://saverapi.net/pricing
|
|
15
|
+
Project-URL: Changelog, https://saverapi.net/whats-new
|
|
16
|
+
Project-URL: Telegram, https://t.me/SaverAPI
|
|
17
|
+
Keywords: saverapi,social media downloader api,video downloader api,all in one downloader,instagram downloader,instagram reels downloader,instagram api,instagram profile api,tiktok downloader,tiktok video api,tiktok no watermark,youtube downloader,youtube api python,youtube video download,youtube mp3,youtube subtitles,yt-dlp alternative,facebook video downloader,twitter video downloader,x video downloader,pinterest downloader,threads downloader,snapchat downloader,vimeo downloader,soundcloud downloader,shazam api,song recognition,music recognition api,music search api,shazam charts,nsfw scanner,nsfw detection api,photolab api,telegram bot downloader,aiogram,async api client,python sdk,rest api client
|
|
18
|
+
Classifier: Development Status :: 5 - Production/Stable
|
|
19
|
+
Classifier: Intended Audience :: Developers
|
|
20
|
+
Classifier: License :: OSI Approved :: MIT License
|
|
21
|
+
Classifier: Operating System :: OS Independent
|
|
22
|
+
Classifier: Programming Language :: Python :: 3
|
|
23
|
+
Classifier: Programming Language :: Python :: 3 :: Only
|
|
24
|
+
Classifier: Programming Language :: Python :: 3.8
|
|
25
|
+
Classifier: Programming Language :: Python :: 3.9
|
|
26
|
+
Classifier: Programming Language :: Python :: 3.10
|
|
27
|
+
Classifier: Programming Language :: Python :: 3.11
|
|
28
|
+
Classifier: Programming Language :: Python :: 3.12
|
|
29
|
+
Classifier: Programming Language :: Python :: 3.13
|
|
30
|
+
Classifier: Framework :: AsyncIO
|
|
31
|
+
Classifier: Typing :: Typed
|
|
32
|
+
Classifier: Topic :: Internet :: WWW/HTTP
|
|
33
|
+
Classifier: Topic :: Multimedia :: Video
|
|
34
|
+
Classifier: Topic :: Multimedia :: Sound/Audio
|
|
35
|
+
Classifier: Topic :: Communications :: Chat
|
|
36
|
+
Classifier: Topic :: Software Development :: Libraries :: Python Modules
|
|
37
|
+
Requires-Python: >=3.8
|
|
38
|
+
Description-Content-Type: text/markdown
|
|
39
|
+
License-File: LICENSE
|
|
40
|
+
Requires-Dist: requests>=2.25
|
|
41
|
+
Provides-Extra: async
|
|
42
|
+
Requires-Dist: httpx>=0.24; extra == "async"
|
|
43
|
+
Dynamic: license-file
|
|
44
|
+
|
|
45
|
+
<div align="center">
|
|
46
|
+
|
|
47
|
+
# SaverAPI Python SDK
|
|
48
|
+
|
|
49
|
+
### Social media downloader API for Python — Instagram, TikTok, YouTube, Facebook, X and more
|
|
50
|
+
|
|
51
|
+
Official client for **[SaverAPI.NET](https://saverapi.net)**: download videos, Reels and audio, read YouTube metadata and subtitles, look up Instagram profiles, recognise songs with Shazam and scan media for NSFW content — with one API key, from sync code, `asyncio` or the command line.
|
|
52
|
+
|
|
53
|
+
[](https://pypi.org/project/saverapi-client/)
|
|
54
|
+
[](https://pypi.org/project/saverapi-client/)
|
|
55
|
+
[](#license)
|
|
56
|
+
[](https://saverapi.net/docs)
|
|
57
|
+
|
|
58
|
+
</div>
|
|
59
|
+
|
|
60
|
+
```bash
|
|
61
|
+
pip install -U saverapi-client # sync client + CLI
|
|
62
|
+
pip install -U "saverapi-client[async]" # + AsyncSaverAPI (httpx)
|
|
63
|
+
```
|
|
64
|
+
|
|
65
|
+
Get a free API key at **[saverapi.net](https://saverapi.net/auth/register)** — no card needed.
|
|
66
|
+
|
|
67
|
+
---
|
|
68
|
+
|
|
69
|
+
## Quick start
|
|
70
|
+
|
|
71
|
+
```python
|
|
72
|
+
from saverapi import SaverAPI
|
|
73
|
+
|
|
74
|
+
api = SaverAPI(api_key="YOUR_API_KEY") # or export SAVERAPI_KEY=...
|
|
75
|
+
|
|
76
|
+
media = api.download("https://www.instagram.com/reel/DPOi9V-CAqH/")
|
|
77
|
+
print(media["hosting"], media["type"], media["download_url"])
|
|
78
|
+
|
|
79
|
+
api.save_file(media["download_url"], "downloads/reel.mp4")
|
|
80
|
+
```
|
|
81
|
+
|
|
82
|
+
One call, one parameter: the **All-in-One downloader** recognises the platform from the link. The response's `hosting` field tells you which network it was, `type` is `video` or `image`, and `download_url` points at the file.
|
|
83
|
+
|
|
84
|
+
## Supported platforms
|
|
85
|
+
|
|
86
|
+
| Platform | Method | REST endpoint |
|
|
87
|
+
|---|---|---|
|
|
88
|
+
| Instagram (posts, Reels) | `api.download(url)` | [`/all-in-one-downloader-api`](https://saverapi.net/instagram-downloader-api) |
|
|
89
|
+
| TikTok | `api.download(url)` | [`/all-in-one-downloader-api`](https://saverapi.net/tiktok-downloader-api) |
|
|
90
|
+
| Facebook | `api.download(url)` | [`/all-in-one-downloader-api`](https://saverapi.net/facebook-video-api) |
|
|
91
|
+
| Twitter / X | `api.download(url)` | [`/all-in-one-downloader-api`](https://saverapi.net/twitter-video-api) |
|
|
92
|
+
| Snapchat, Pinterest, Likee, Threads, Twitch, Weibo, Vimeo, SoundCloud, Spotify | `api.download(url)` | [`/all-in-one-downloader-api`](https://saverapi.net/all-in-one-downloader-api) |
|
|
93
|
+
| YouTube video / MP3 | `api.youtube(url, format)` | [`/youtube-api`](https://saverapi.net/youtube-downloader-api) |
|
|
94
|
+
| YouTube for Telegram bots | `api.youtube_telegram(url, format)` | `/youtube-telegram-base` |
|
|
95
|
+
| YouTube metadata | `api.youtube_info(url)` · `api.youtube_info_basic(url)` | `/youtube-info-v2` · `/youtube-info` |
|
|
96
|
+
| YouTube subtitles | `api.youtube_subtitles(url)` | `/youtube-subtitles` |
|
|
97
|
+
| Instagram profile | `api.instagram_profile(username)` | `/instagram-profile` |
|
|
98
|
+
| Shazam song recognition | `api.shazam_recognize(url)` | [`/shazam-recognize`](https://saverapi.net/shazam-api) |
|
|
99
|
+
| Shazam top charts | `api.shazam_top(country)` | `/shazam-music-top` |
|
|
100
|
+
| Music search | `api.music_search(query, limit)` | `/music-search` |
|
|
101
|
+
| PhotoLab effects | `api.photolab(effect_id, photo_url)` | `/photolab-api` |
|
|
102
|
+
| NSFW scanner | `api.nsfw_scan(url)` | `/nsfw-scanner-api` |
|
|
103
|
+
| Account balance (free) | `api.info_balance()` | `/infobalans` |
|
|
104
|
+
| Key statistics (free) | `api.api_keys_statistics()` | `/api-keys/all-statistics` |
|
|
105
|
+
|
|
106
|
+
Full parameter reference and response samples: **[saverapi.net/docs](https://saverapi.net/docs)**. Endpoints added to the catalog later can be called with `api.request("/endpoint-path", {"param": "value"})`.
|
|
107
|
+
|
|
108
|
+
## Examples
|
|
109
|
+
|
|
110
|
+
### Download a YouTube video or MP3
|
|
111
|
+
|
|
112
|
+
```python
|
|
113
|
+
video = api.youtube("https://youtu.be/OORSiK8ScTI", format="720") # 1080|720|480|360|240|144|mp3
|
|
114
|
+
api.save_file(video["url"], "video.mp4")
|
|
115
|
+
|
|
116
|
+
info = api.youtube_info("https://youtu.be/OORSiK8ScTI")
|
|
117
|
+
print(info["title"], info["duration"])
|
|
118
|
+
```
|
|
119
|
+
|
|
120
|
+
### Download TikTok, Facebook or X videos
|
|
121
|
+
|
|
122
|
+
```python
|
|
123
|
+
for link in [
|
|
124
|
+
"https://www.tiktok.com/@user/video/7300000000000000000",
|
|
125
|
+
"https://www.facebook.com/watch/?v=1234567890",
|
|
126
|
+
"https://x.com/user/status/1234567890",
|
|
127
|
+
]:
|
|
128
|
+
media = api.download(link)
|
|
129
|
+
print(media["hosting"], media["download_url"])
|
|
130
|
+
```
|
|
131
|
+
|
|
132
|
+
### Instagram profile
|
|
133
|
+
|
|
134
|
+
```python
|
|
135
|
+
profile = api.instagram_profile("cristiano")
|
|
136
|
+
print(profile["user"]["full_name"], profile["user"]["is_verified"])
|
|
137
|
+
```
|
|
138
|
+
|
|
139
|
+
### Recognise a song, search music, read charts
|
|
140
|
+
|
|
141
|
+
```python
|
|
142
|
+
song = api.shazam_recognize("https://example.com/clip.mp3")
|
|
143
|
+
print(song["track"]["title"], "—", song["track"]["subtitle"])
|
|
144
|
+
|
|
145
|
+
results = api.music_search("Hello Adele", limit=5)
|
|
146
|
+
top = api.shazam_top("united-states")
|
|
147
|
+
```
|
|
148
|
+
|
|
149
|
+
### Check your plan and credits (free)
|
|
150
|
+
|
|
151
|
+
```python
|
|
152
|
+
print(api.info_balance())
|
|
153
|
+
```
|
|
154
|
+
|
|
155
|
+
## Async (aiogram, FastAPI, asyncio)
|
|
156
|
+
|
|
157
|
+
```python
|
|
158
|
+
import asyncio
|
|
159
|
+
from saverapi import AsyncSaverAPI
|
|
160
|
+
|
|
161
|
+
async def main():
|
|
162
|
+
async with AsyncSaverAPI() as api: # reads SAVERAPI_KEY
|
|
163
|
+
results = await asyncio.gather(
|
|
164
|
+
api.download("https://www.instagram.com/reel/DPOi9V-CAqH/"),
|
|
165
|
+
api.youtube_info("https://youtu.be/OORSiK8ScTI"),
|
|
166
|
+
)
|
|
167
|
+
print(results)
|
|
168
|
+
|
|
169
|
+
asyncio.run(main())
|
|
170
|
+
```
|
|
171
|
+
|
|
172
|
+
### Telegram downloader bot (aiogram 3)
|
|
173
|
+
|
|
174
|
+
```python
|
|
175
|
+
from aiogram import Bot, Dispatcher, F
|
|
176
|
+
from aiogram.types import Message
|
|
177
|
+
from saverapi import AsyncSaverAPI, SaverAPIError
|
|
178
|
+
|
|
179
|
+
bot = Bot("TELEGRAM_BOT_TOKEN")
|
|
180
|
+
dp = Dispatcher()
|
|
181
|
+
api = AsyncSaverAPI() # SAVERAPI_KEY from the environment
|
|
182
|
+
|
|
183
|
+
@dp.message(F.text.startswith("http"))
|
|
184
|
+
async def on_link(message: Message):
|
|
185
|
+
try:
|
|
186
|
+
media = await api.download(message.text.strip())
|
|
187
|
+
except SaverAPIError as exc:
|
|
188
|
+
await message.answer(f"Could not download: {exc.message}")
|
|
189
|
+
return
|
|
190
|
+
if media.get("type") == "image":
|
|
191
|
+
await message.answer_photo(media["download_url"])
|
|
192
|
+
else:
|
|
193
|
+
await message.answer_video(media["download_url"])
|
|
194
|
+
|
|
195
|
+
dp.run_polling(bot)
|
|
196
|
+
```
|
|
197
|
+
|
|
198
|
+
Step-by-step guide: **[Build a Telegram video downloader bot](https://saverapi.net/blog/build-telegram-video-downloader-bot)**.
|
|
199
|
+
|
|
200
|
+
## Command line
|
|
201
|
+
|
|
202
|
+
```bash
|
|
203
|
+
export SAVERAPI_KEY=your_key
|
|
204
|
+
saverapi download https://www.instagram.com/reel/DPOi9V-CAqH/
|
|
205
|
+
saverapi youtube https://youtu.be/OORSiK8ScTI --format mp3
|
|
206
|
+
saverapi youtube-info https://youtu.be/OORSiK8ScTI
|
|
207
|
+
saverapi instagram cristiano
|
|
208
|
+
saverapi shazam https://example.com/clip.mp3
|
|
209
|
+
saverapi balance
|
|
210
|
+
```
|
|
211
|
+
|
|
212
|
+
Prints the JSON response; exits with status 1 on an API error.
|
|
213
|
+
|
|
214
|
+
## Errors and retries
|
|
215
|
+
|
|
216
|
+
Rate limits (`429`) and temporary server errors (`5xx`) are retried automatically with exponential backoff (`max_retries=2` by default). Failed 5xx calls are not charged. Everything else raises a specific exception:
|
|
217
|
+
|
|
218
|
+
```python
|
|
219
|
+
from saverapi import (
|
|
220
|
+
SaverAPIError, AuthenticationError, InsufficientCreditsError,
|
|
221
|
+
RateLimitError, NotFoundError, ServerError, NetworkError,
|
|
222
|
+
)
|
|
223
|
+
|
|
224
|
+
try:
|
|
225
|
+
api.download(link)
|
|
226
|
+
except AuthenticationError: # 401/403 — wrong or disabled key
|
|
227
|
+
...
|
|
228
|
+
except InsufficientCreditsError: # 402 — top up or upgrade at saverapi.net/pricing
|
|
229
|
+
...
|
|
230
|
+
except RateLimitError as exc: # 429 after retries
|
|
231
|
+
...
|
|
232
|
+
except SaverAPIError as exc: # anything else; exc.status_code, exc.message, exc.payload
|
|
233
|
+
...
|
|
234
|
+
```
|
|
235
|
+
|
|
236
|
+
Options: `SaverAPI(api_key=None, timeout=60, base_url=None, session=None, max_retries=2, backoff=1.0)`. Use it as a context manager (`with SaverAPI() as api:`) to close the HTTP session.
|
|
237
|
+
|
|
238
|
+
## Tips
|
|
239
|
+
|
|
240
|
+
- Media links (`download_url`) come from the networks' CDNs and **expire** — download them right after the call.
|
|
241
|
+
- Only public content can be resolved; private accounts and deleted posts fail.
|
|
242
|
+
- Keep the API key on your server; mobile and web apps should call your backend.
|
|
243
|
+
- Respect each platform's terms of service and creators' rights.
|
|
244
|
+
|
|
245
|
+
## Links
|
|
246
|
+
|
|
247
|
+
- Website and free API key: https://saverapi.net
|
|
248
|
+
- API documentation: https://saverapi.net/docs
|
|
249
|
+
- YouTube Downloader API: https://saverapi.net/youtube-downloader-api
|
|
250
|
+
- Instagram Downloader API: https://saverapi.net/instagram-downloader-api
|
|
251
|
+
- TikTok Downloader API: https://saverapi.net/tiktok-downloader-api
|
|
252
|
+
- All-in-One Downloader API: https://saverapi.net/all-in-one-downloader-api
|
|
253
|
+
- Tutorials: https://saverapi.net/blog
|
|
254
|
+
- Pricing: https://saverapi.net/pricing
|
|
255
|
+
- Telegram: https://t.me/SaverAPI
|
|
256
|
+
|
|
257
|
+
## Changelog
|
|
258
|
+
|
|
259
|
+
**1.1.0**
|
|
260
|
+
- New methods covering the whole catalog: `youtube_telegram`, `youtube_info_basic`, `youtube_subtitles`, `instagram_profile`, `photolab`, and `request()` for any endpoint.
|
|
261
|
+
- `AsyncSaverAPI` for asyncio (`pip install "saverapi-client[async]"`).
|
|
262
|
+
- `saverapi` command line tool.
|
|
263
|
+
- Automatic retries with backoff for 429 and 5xx; specific exception classes.
|
|
264
|
+
- API key from the `SAVERAPI_KEY` environment variable; context-manager support; type hints (`py.typed`).
|
|
265
|
+
- Fully backwards compatible with 1.0.x.
|
|
266
|
+
|
|
267
|
+
## License
|
|
268
|
+
|
|
269
|
+
MIT © SaverAPI.NET
|
|
@@ -0,0 +1,225 @@
|
|
|
1
|
+
<div align="center">
|
|
2
|
+
|
|
3
|
+
# SaverAPI Python SDK
|
|
4
|
+
|
|
5
|
+
### Social media downloader API for Python — Instagram, TikTok, YouTube, Facebook, X and more
|
|
6
|
+
|
|
7
|
+
Official client for **[SaverAPI.NET](https://saverapi.net)**: download videos, Reels and audio, read YouTube metadata and subtitles, look up Instagram profiles, recognise songs with Shazam and scan media for NSFW content — with one API key, from sync code, `asyncio` or the command line.
|
|
8
|
+
|
|
9
|
+
[](https://pypi.org/project/saverapi-client/)
|
|
10
|
+
[](https://pypi.org/project/saverapi-client/)
|
|
11
|
+
[](#license)
|
|
12
|
+
[](https://saverapi.net/docs)
|
|
13
|
+
|
|
14
|
+
</div>
|
|
15
|
+
|
|
16
|
+
```bash
|
|
17
|
+
pip install -U saverapi-client # sync client + CLI
|
|
18
|
+
pip install -U "saverapi-client[async]" # + AsyncSaverAPI (httpx)
|
|
19
|
+
```
|
|
20
|
+
|
|
21
|
+
Get a free API key at **[saverapi.net](https://saverapi.net/auth/register)** — no card needed.
|
|
22
|
+
|
|
23
|
+
---
|
|
24
|
+
|
|
25
|
+
## Quick start
|
|
26
|
+
|
|
27
|
+
```python
|
|
28
|
+
from saverapi import SaverAPI
|
|
29
|
+
|
|
30
|
+
api = SaverAPI(api_key="YOUR_API_KEY") # or export SAVERAPI_KEY=...
|
|
31
|
+
|
|
32
|
+
media = api.download("https://www.instagram.com/reel/DPOi9V-CAqH/")
|
|
33
|
+
print(media["hosting"], media["type"], media["download_url"])
|
|
34
|
+
|
|
35
|
+
api.save_file(media["download_url"], "downloads/reel.mp4")
|
|
36
|
+
```
|
|
37
|
+
|
|
38
|
+
One call, one parameter: the **All-in-One downloader** recognises the platform from the link. The response's `hosting` field tells you which network it was, `type` is `video` or `image`, and `download_url` points at the file.
|
|
39
|
+
|
|
40
|
+
## Supported platforms
|
|
41
|
+
|
|
42
|
+
| Platform | Method | REST endpoint |
|
|
43
|
+
|---|---|---|
|
|
44
|
+
| Instagram (posts, Reels) | `api.download(url)` | [`/all-in-one-downloader-api`](https://saverapi.net/instagram-downloader-api) |
|
|
45
|
+
| TikTok | `api.download(url)` | [`/all-in-one-downloader-api`](https://saverapi.net/tiktok-downloader-api) |
|
|
46
|
+
| Facebook | `api.download(url)` | [`/all-in-one-downloader-api`](https://saverapi.net/facebook-video-api) |
|
|
47
|
+
| Twitter / X | `api.download(url)` | [`/all-in-one-downloader-api`](https://saverapi.net/twitter-video-api) |
|
|
48
|
+
| Snapchat, Pinterest, Likee, Threads, Twitch, Weibo, Vimeo, SoundCloud, Spotify | `api.download(url)` | [`/all-in-one-downloader-api`](https://saverapi.net/all-in-one-downloader-api) |
|
|
49
|
+
| YouTube video / MP3 | `api.youtube(url, format)` | [`/youtube-api`](https://saverapi.net/youtube-downloader-api) |
|
|
50
|
+
| YouTube for Telegram bots | `api.youtube_telegram(url, format)` | `/youtube-telegram-base` |
|
|
51
|
+
| YouTube metadata | `api.youtube_info(url)` · `api.youtube_info_basic(url)` | `/youtube-info-v2` · `/youtube-info` |
|
|
52
|
+
| YouTube subtitles | `api.youtube_subtitles(url)` | `/youtube-subtitles` |
|
|
53
|
+
| Instagram profile | `api.instagram_profile(username)` | `/instagram-profile` |
|
|
54
|
+
| Shazam song recognition | `api.shazam_recognize(url)` | [`/shazam-recognize`](https://saverapi.net/shazam-api) |
|
|
55
|
+
| Shazam top charts | `api.shazam_top(country)` | `/shazam-music-top` |
|
|
56
|
+
| Music search | `api.music_search(query, limit)` | `/music-search` |
|
|
57
|
+
| PhotoLab effects | `api.photolab(effect_id, photo_url)` | `/photolab-api` |
|
|
58
|
+
| NSFW scanner | `api.nsfw_scan(url)` | `/nsfw-scanner-api` |
|
|
59
|
+
| Account balance (free) | `api.info_balance()` | `/infobalans` |
|
|
60
|
+
| Key statistics (free) | `api.api_keys_statistics()` | `/api-keys/all-statistics` |
|
|
61
|
+
|
|
62
|
+
Full parameter reference and response samples: **[saverapi.net/docs](https://saverapi.net/docs)**. Endpoints added to the catalog later can be called with `api.request("/endpoint-path", {"param": "value"})`.
|
|
63
|
+
|
|
64
|
+
## Examples
|
|
65
|
+
|
|
66
|
+
### Download a YouTube video or MP3
|
|
67
|
+
|
|
68
|
+
```python
|
|
69
|
+
video = api.youtube("https://youtu.be/OORSiK8ScTI", format="720") # 1080|720|480|360|240|144|mp3
|
|
70
|
+
api.save_file(video["url"], "video.mp4")
|
|
71
|
+
|
|
72
|
+
info = api.youtube_info("https://youtu.be/OORSiK8ScTI")
|
|
73
|
+
print(info["title"], info["duration"])
|
|
74
|
+
```
|
|
75
|
+
|
|
76
|
+
### Download TikTok, Facebook or X videos
|
|
77
|
+
|
|
78
|
+
```python
|
|
79
|
+
for link in [
|
|
80
|
+
"https://www.tiktok.com/@user/video/7300000000000000000",
|
|
81
|
+
"https://www.facebook.com/watch/?v=1234567890",
|
|
82
|
+
"https://x.com/user/status/1234567890",
|
|
83
|
+
]:
|
|
84
|
+
media = api.download(link)
|
|
85
|
+
print(media["hosting"], media["download_url"])
|
|
86
|
+
```
|
|
87
|
+
|
|
88
|
+
### Instagram profile
|
|
89
|
+
|
|
90
|
+
```python
|
|
91
|
+
profile = api.instagram_profile("cristiano")
|
|
92
|
+
print(profile["user"]["full_name"], profile["user"]["is_verified"])
|
|
93
|
+
```
|
|
94
|
+
|
|
95
|
+
### Recognise a song, search music, read charts
|
|
96
|
+
|
|
97
|
+
```python
|
|
98
|
+
song = api.shazam_recognize("https://example.com/clip.mp3")
|
|
99
|
+
print(song["track"]["title"], "—", song["track"]["subtitle"])
|
|
100
|
+
|
|
101
|
+
results = api.music_search("Hello Adele", limit=5)
|
|
102
|
+
top = api.shazam_top("united-states")
|
|
103
|
+
```
|
|
104
|
+
|
|
105
|
+
### Check your plan and credits (free)
|
|
106
|
+
|
|
107
|
+
```python
|
|
108
|
+
print(api.info_balance())
|
|
109
|
+
```
|
|
110
|
+
|
|
111
|
+
## Async (aiogram, FastAPI, asyncio)
|
|
112
|
+
|
|
113
|
+
```python
|
|
114
|
+
import asyncio
|
|
115
|
+
from saverapi import AsyncSaverAPI
|
|
116
|
+
|
|
117
|
+
async def main():
|
|
118
|
+
async with AsyncSaverAPI() as api: # reads SAVERAPI_KEY
|
|
119
|
+
results = await asyncio.gather(
|
|
120
|
+
api.download("https://www.instagram.com/reel/DPOi9V-CAqH/"),
|
|
121
|
+
api.youtube_info("https://youtu.be/OORSiK8ScTI"),
|
|
122
|
+
)
|
|
123
|
+
print(results)
|
|
124
|
+
|
|
125
|
+
asyncio.run(main())
|
|
126
|
+
```
|
|
127
|
+
|
|
128
|
+
### Telegram downloader bot (aiogram 3)
|
|
129
|
+
|
|
130
|
+
```python
|
|
131
|
+
from aiogram import Bot, Dispatcher, F
|
|
132
|
+
from aiogram.types import Message
|
|
133
|
+
from saverapi import AsyncSaverAPI, SaverAPIError
|
|
134
|
+
|
|
135
|
+
bot = Bot("TELEGRAM_BOT_TOKEN")
|
|
136
|
+
dp = Dispatcher()
|
|
137
|
+
api = AsyncSaverAPI() # SAVERAPI_KEY from the environment
|
|
138
|
+
|
|
139
|
+
@dp.message(F.text.startswith("http"))
|
|
140
|
+
async def on_link(message: Message):
|
|
141
|
+
try:
|
|
142
|
+
media = await api.download(message.text.strip())
|
|
143
|
+
except SaverAPIError as exc:
|
|
144
|
+
await message.answer(f"Could not download: {exc.message}")
|
|
145
|
+
return
|
|
146
|
+
if media.get("type") == "image":
|
|
147
|
+
await message.answer_photo(media["download_url"])
|
|
148
|
+
else:
|
|
149
|
+
await message.answer_video(media["download_url"])
|
|
150
|
+
|
|
151
|
+
dp.run_polling(bot)
|
|
152
|
+
```
|
|
153
|
+
|
|
154
|
+
Step-by-step guide: **[Build a Telegram video downloader bot](https://saverapi.net/blog/build-telegram-video-downloader-bot)**.
|
|
155
|
+
|
|
156
|
+
## Command line
|
|
157
|
+
|
|
158
|
+
```bash
|
|
159
|
+
export SAVERAPI_KEY=your_key
|
|
160
|
+
saverapi download https://www.instagram.com/reel/DPOi9V-CAqH/
|
|
161
|
+
saverapi youtube https://youtu.be/OORSiK8ScTI --format mp3
|
|
162
|
+
saverapi youtube-info https://youtu.be/OORSiK8ScTI
|
|
163
|
+
saverapi instagram cristiano
|
|
164
|
+
saverapi shazam https://example.com/clip.mp3
|
|
165
|
+
saverapi balance
|
|
166
|
+
```
|
|
167
|
+
|
|
168
|
+
Prints the JSON response; exits with status 1 on an API error.
|
|
169
|
+
|
|
170
|
+
## Errors and retries
|
|
171
|
+
|
|
172
|
+
Rate limits (`429`) and temporary server errors (`5xx`) are retried automatically with exponential backoff (`max_retries=2` by default). Failed 5xx calls are not charged. Everything else raises a specific exception:
|
|
173
|
+
|
|
174
|
+
```python
|
|
175
|
+
from saverapi import (
|
|
176
|
+
SaverAPIError, AuthenticationError, InsufficientCreditsError,
|
|
177
|
+
RateLimitError, NotFoundError, ServerError, NetworkError,
|
|
178
|
+
)
|
|
179
|
+
|
|
180
|
+
try:
|
|
181
|
+
api.download(link)
|
|
182
|
+
except AuthenticationError: # 401/403 — wrong or disabled key
|
|
183
|
+
...
|
|
184
|
+
except InsufficientCreditsError: # 402 — top up or upgrade at saverapi.net/pricing
|
|
185
|
+
...
|
|
186
|
+
except RateLimitError as exc: # 429 after retries
|
|
187
|
+
...
|
|
188
|
+
except SaverAPIError as exc: # anything else; exc.status_code, exc.message, exc.payload
|
|
189
|
+
...
|
|
190
|
+
```
|
|
191
|
+
|
|
192
|
+
Options: `SaverAPI(api_key=None, timeout=60, base_url=None, session=None, max_retries=2, backoff=1.0)`. Use it as a context manager (`with SaverAPI() as api:`) to close the HTTP session.
|
|
193
|
+
|
|
194
|
+
## Tips
|
|
195
|
+
|
|
196
|
+
- Media links (`download_url`) come from the networks' CDNs and **expire** — download them right after the call.
|
|
197
|
+
- Only public content can be resolved; private accounts and deleted posts fail.
|
|
198
|
+
- Keep the API key on your server; mobile and web apps should call your backend.
|
|
199
|
+
- Respect each platform's terms of service and creators' rights.
|
|
200
|
+
|
|
201
|
+
## Links
|
|
202
|
+
|
|
203
|
+
- Website and free API key: https://saverapi.net
|
|
204
|
+
- API documentation: https://saverapi.net/docs
|
|
205
|
+
- YouTube Downloader API: https://saverapi.net/youtube-downloader-api
|
|
206
|
+
- Instagram Downloader API: https://saverapi.net/instagram-downloader-api
|
|
207
|
+
- TikTok Downloader API: https://saverapi.net/tiktok-downloader-api
|
|
208
|
+
- All-in-One Downloader API: https://saverapi.net/all-in-one-downloader-api
|
|
209
|
+
- Tutorials: https://saverapi.net/blog
|
|
210
|
+
- Pricing: https://saverapi.net/pricing
|
|
211
|
+
- Telegram: https://t.me/SaverAPI
|
|
212
|
+
|
|
213
|
+
## Changelog
|
|
214
|
+
|
|
215
|
+
**1.1.0**
|
|
216
|
+
- New methods covering the whole catalog: `youtube_telegram`, `youtube_info_basic`, `youtube_subtitles`, `instagram_profile`, `photolab`, and `request()` for any endpoint.
|
|
217
|
+
- `AsyncSaverAPI` for asyncio (`pip install "saverapi-client[async]"`).
|
|
218
|
+
- `saverapi` command line tool.
|
|
219
|
+
- Automatic retries with backoff for 429 and 5xx; specific exception classes.
|
|
220
|
+
- API key from the `SAVERAPI_KEY` environment variable; context-manager support; type hints (`py.typed`).
|
|
221
|
+
- Fully backwards compatible with 1.0.x.
|
|
222
|
+
|
|
223
|
+
## License
|
|
224
|
+
|
|
225
|
+
MIT © SaverAPI.NET
|
|
@@ -0,0 +1,72 @@
|
|
|
1
|
+
[build-system]
|
|
2
|
+
requires = ["setuptools>=68", "wheel"]
|
|
3
|
+
build-backend = "setuptools.build_meta"
|
|
4
|
+
|
|
5
|
+
[project]
|
|
6
|
+
name = "saverapi-client"
|
|
7
|
+
dynamic = ["version"]
|
|
8
|
+
description = "Official Python SDK for SaverAPI.NET — social media downloader API for Instagram, TikTok, YouTube, Facebook, X, Pinterest, Threads, Vimeo, plus Shazam, music search and NSFW scan. Sync, async and CLI."
|
|
9
|
+
readme = "README.md"
|
|
10
|
+
requires-python = ">=3.8"
|
|
11
|
+
license = { text = "MIT" }
|
|
12
|
+
authors = [{ name = "SaverAPI.NET", email = "saverapinet@gmail.com" }]
|
|
13
|
+
dependencies = ["requests>=2.25"]
|
|
14
|
+
keywords = [
|
|
15
|
+
"saverapi", "social media downloader api", "video downloader api", "all in one downloader",
|
|
16
|
+
"instagram downloader", "instagram reels downloader", "instagram api", "instagram profile api",
|
|
17
|
+
"tiktok downloader", "tiktok video api", "tiktok no watermark",
|
|
18
|
+
"youtube downloader", "youtube api python", "youtube video download", "youtube mp3", "youtube subtitles", "yt-dlp alternative",
|
|
19
|
+
"facebook video downloader", "twitter video downloader", "x video downloader",
|
|
20
|
+
"pinterest downloader", "threads downloader", "snapchat downloader", "vimeo downloader", "soundcloud downloader",
|
|
21
|
+
"shazam api", "song recognition", "music recognition api", "music search api", "shazam charts",
|
|
22
|
+
"nsfw scanner", "nsfw detection api", "photolab api",
|
|
23
|
+
"telegram bot downloader", "aiogram", "async api client", "python sdk", "rest api client",
|
|
24
|
+
]
|
|
25
|
+
classifiers = [
|
|
26
|
+
"Development Status :: 5 - Production/Stable",
|
|
27
|
+
"Intended Audience :: Developers",
|
|
28
|
+
"License :: OSI Approved :: MIT License",
|
|
29
|
+
"Operating System :: OS Independent",
|
|
30
|
+
"Programming Language :: Python :: 3",
|
|
31
|
+
"Programming Language :: Python :: 3 :: Only",
|
|
32
|
+
"Programming Language :: Python :: 3.8",
|
|
33
|
+
"Programming Language :: Python :: 3.9",
|
|
34
|
+
"Programming Language :: Python :: 3.10",
|
|
35
|
+
"Programming Language :: Python :: 3.11",
|
|
36
|
+
"Programming Language :: Python :: 3.12",
|
|
37
|
+
"Programming Language :: Python :: 3.13",
|
|
38
|
+
"Framework :: AsyncIO",
|
|
39
|
+
"Typing :: Typed",
|
|
40
|
+
"Topic :: Internet :: WWW/HTTP",
|
|
41
|
+
"Topic :: Multimedia :: Video",
|
|
42
|
+
"Topic :: Multimedia :: Sound/Audio",
|
|
43
|
+
"Topic :: Communications :: Chat",
|
|
44
|
+
"Topic :: Software Development :: Libraries :: Python Modules",
|
|
45
|
+
]
|
|
46
|
+
|
|
47
|
+
[project.optional-dependencies]
|
|
48
|
+
async = ["httpx>=0.24"]
|
|
49
|
+
|
|
50
|
+
[project.scripts]
|
|
51
|
+
saverapi = "saverapi.cli:main"
|
|
52
|
+
|
|
53
|
+
[project.urls]
|
|
54
|
+
Homepage = "https://saverapi.net"
|
|
55
|
+
Documentation = "https://saverapi.net/docs"
|
|
56
|
+
"API catalog" = "https://saverapi.net/all-in-one-downloader-api"
|
|
57
|
+
"YouTube Downloader API" = "https://saverapi.net/youtube-downloader-api"
|
|
58
|
+
"Instagram Downloader API" = "https://saverapi.net/instagram-downloader-api"
|
|
59
|
+
"TikTok Downloader API" = "https://saverapi.net/tiktok-downloader-api"
|
|
60
|
+
Tutorials = "https://saverapi.net/blog"
|
|
61
|
+
Pricing = "https://saverapi.net/pricing"
|
|
62
|
+
Changelog = "https://saverapi.net/whats-new"
|
|
63
|
+
Telegram = "https://t.me/SaverAPI"
|
|
64
|
+
|
|
65
|
+
[tool.setuptools]
|
|
66
|
+
packages = ["saverapi"]
|
|
67
|
+
|
|
68
|
+
[tool.setuptools.dynamic]
|
|
69
|
+
version = { attr = "saverapi._version.__version__" }
|
|
70
|
+
|
|
71
|
+
[tool.setuptools.package-data]
|
|
72
|
+
saverapi = ["py.typed"]
|
|
@@ -0,0 +1,38 @@
|
|
|
1
|
+
"""
|
|
2
|
+
saverapi — official Python SDK for SaverAPI.NET (https://saverapi.net).
|
|
3
|
+
|
|
4
|
+
Social media downloader and media data API: Instagram, TikTok, YouTube,
|
|
5
|
+
Facebook, Twitter (X), Pinterest, Threads, Vimeo and more, plus Shazam
|
|
6
|
+
recognition, music search, YouTube metadata and subtitles, Instagram
|
|
7
|
+
profiles and an NSFW scanner.
|
|
8
|
+
|
|
9
|
+
from saverapi import SaverAPI
|
|
10
|
+
api = SaverAPI(api_key="YOUR_API_KEY") # or set SAVERAPI_KEY
|
|
11
|
+
api.download("https://www.instagram.com/reel/xxxx/")
|
|
12
|
+
"""
|
|
13
|
+
|
|
14
|
+
from ._version import __version__
|
|
15
|
+
from .async_client import AsyncSaverAPI
|
|
16
|
+
from .client import SaverAPI
|
|
17
|
+
from .exceptions import (
|
|
18
|
+
AuthenticationError,
|
|
19
|
+
InsufficientCreditsError,
|
|
20
|
+
NetworkError,
|
|
21
|
+
NotFoundError,
|
|
22
|
+
RateLimitError,
|
|
23
|
+
SaverAPIError,
|
|
24
|
+
ServerError,
|
|
25
|
+
)
|
|
26
|
+
|
|
27
|
+
__all__ = [
|
|
28
|
+
"SaverAPI",
|
|
29
|
+
"AsyncSaverAPI",
|
|
30
|
+
"SaverAPIError",
|
|
31
|
+
"AuthenticationError",
|
|
32
|
+
"InsufficientCreditsError",
|
|
33
|
+
"RateLimitError",
|
|
34
|
+
"NotFoundError",
|
|
35
|
+
"ServerError",
|
|
36
|
+
"NetworkError",
|
|
37
|
+
"__version__",
|
|
38
|
+
]
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
__version__ = "1.1.0"
|