saverapi-client 1.1.0__tar.gz → 2.0.1__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-2.0.1/PKG-INFO +679 -0
- saverapi_client-2.0.1/README.md +634 -0
- {saverapi_client-1.1.0 → saverapi_client-2.0.1}/pyproject.toml +5 -4
- {saverapi_client-1.1.0 → saverapi_client-2.0.1}/saverapi/__init__.py +6 -4
- saverapi_client-2.0.1/saverapi/_version.py +1 -0
- {saverapi_client-1.1.0 → saverapi_client-2.0.1}/saverapi/async_client.py +15 -11
- {saverapi_client-1.1.0 → saverapi_client-2.0.1}/saverapi/cli.py +7 -4
- {saverapi_client-1.1.0 → saverapi_client-2.0.1}/saverapi/client.py +45 -20
- saverapi_client-2.0.1/saverapi_client.egg-info/PKG-INFO +679 -0
- {saverapi_client-1.1.0 → saverapi_client-2.0.1}/tests/test_client.py +54 -8
- saverapi_client-1.1.0/PKG-INFO +0 -269
- saverapi_client-1.1.0/README.md +0 -225
- saverapi_client-1.1.0/saverapi/_version.py +0 -1
- saverapi_client-1.1.0/saverapi_client.egg-info/PKG-INFO +0 -269
- {saverapi_client-1.1.0 → saverapi_client-2.0.1}/LICENSE +0 -0
- {saverapi_client-1.1.0 → saverapi_client-2.0.1}/saverapi/exceptions.py +0 -0
- {saverapi_client-1.1.0 → saverapi_client-2.0.1}/saverapi/py.typed +0 -0
- {saverapi_client-1.1.0 → saverapi_client-2.0.1}/saverapi_client.egg-info/SOURCES.txt +0 -0
- {saverapi_client-1.1.0 → saverapi_client-2.0.1}/saverapi_client.egg-info/dependency_links.txt +0 -0
- {saverapi_client-1.1.0 → saverapi_client-2.0.1}/saverapi_client.egg-info/entry_points.txt +0 -0
- {saverapi_client-1.1.0 → saverapi_client-2.0.1}/saverapi_client.egg-info/requires.txt +0 -0
- {saverapi_client-1.1.0 → saverapi_client-2.0.1}/saverapi_client.egg-info/top_level.txt +0 -0
- {saverapi_client-1.1.0 → saverapi_client-2.0.1}/setup.cfg +0 -0
|
@@ -0,0 +1,679 @@
|
|
|
1
|
+
Metadata-Version: 2.4
|
|
2
|
+
Name: saverapi-client
|
|
3
|
+
Version: 2.0.1
|
|
4
|
+
Summary: Official Python SDK for SaverAPI.NET — video downloader API for YouTube (4K, MP3), Instagram, TikTok, Facebook, X, Pinterest and Threads, Telegram bot file_id, Shazam, music search, NSFW scan. Sync, async, 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: Shazam API, https://saverapi.net/shazam-api
|
|
14
|
+
Project-URL: Tutorials, https://saverapi.net/blog
|
|
15
|
+
Project-URL: Pricing, https://saverapi.net/pricing
|
|
16
|
+
Project-URL: Changelog, https://saverapi.net/whats-new
|
|
17
|
+
Project-URL: Telegram, https://t.me/SaverAPI
|
|
18
|
+
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 to mp3 api,youtube 4k,youtube 4k downloader,youtube downloader python,telegram file_id,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,telegram bot downloader,telegram bot youtube,aiogram,python-telegram-bot,instagram reels api,social media api,async api client,python sdk,rest api client
|
|
19
|
+
Classifier: Development Status :: 5 - Production/Stable
|
|
20
|
+
Classifier: Intended Audience :: Developers
|
|
21
|
+
Classifier: License :: OSI Approved :: MIT License
|
|
22
|
+
Classifier: Operating System :: OS Independent
|
|
23
|
+
Classifier: Programming Language :: Python :: 3
|
|
24
|
+
Classifier: Programming Language :: Python :: 3 :: Only
|
|
25
|
+
Classifier: Programming Language :: Python :: 3.8
|
|
26
|
+
Classifier: Programming Language :: Python :: 3.9
|
|
27
|
+
Classifier: Programming Language :: Python :: 3.10
|
|
28
|
+
Classifier: Programming Language :: Python :: 3.11
|
|
29
|
+
Classifier: Programming Language :: Python :: 3.12
|
|
30
|
+
Classifier: Programming Language :: Python :: 3.13
|
|
31
|
+
Classifier: Framework :: AsyncIO
|
|
32
|
+
Classifier: Typing :: Typed
|
|
33
|
+
Classifier: Topic :: Internet :: WWW/HTTP
|
|
34
|
+
Classifier: Topic :: Multimedia :: Video
|
|
35
|
+
Classifier: Topic :: Multimedia :: Sound/Audio
|
|
36
|
+
Classifier: Topic :: Communications :: Chat
|
|
37
|
+
Classifier: Topic :: Software Development :: Libraries :: Python Modules
|
|
38
|
+
Requires-Python: >=3.8
|
|
39
|
+
Description-Content-Type: text/markdown
|
|
40
|
+
License-File: LICENSE
|
|
41
|
+
Requires-Dist: requests>=2.25
|
|
42
|
+
Provides-Extra: async
|
|
43
|
+
Requires-Dist: httpx>=0.24; extra == "async"
|
|
44
|
+
Dynamic: license-file
|
|
45
|
+
|
|
46
|
+
<div align="center">
|
|
47
|
+
|
|
48
|
+
# SaverAPI Python SDK
|
|
49
|
+
|
|
50
|
+
### Social media video downloader API for Python — YouTube (up to 4K), Instagram, TikTok, Facebook, X and more
|
|
51
|
+
|
|
52
|
+
Official client for **[SaverAPI.NET](https://saverapi.net)**: download videos, Reels and audio, get YouTube in up to 4K or as a ready Telegram `file_id`, read YouTube metadata, 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.
|
|
53
|
+
|
|
54
|
+
[](https://pypi.org/project/saverapi-client/)
|
|
55
|
+
[](https://pypi.org/project/saverapi-client/)
|
|
56
|
+
[](#license)
|
|
57
|
+
[](https://pypi.org/project/saverapi-client/)
|
|
58
|
+
[](https://saverapi.net/docs)
|
|
59
|
+
[](https://t.me/SaverAPI)
|
|
60
|
+
|
|
61
|
+
</div>
|
|
62
|
+
|
|
63
|
+
```bash
|
|
64
|
+
pip install -U saverapi-client # sync client + CLI
|
|
65
|
+
pip install -U "saverapi-client[async]" # + AsyncSaverAPI (httpx)
|
|
66
|
+
```
|
|
67
|
+
|
|
68
|
+
Get a free API key at **[saverapi.net](https://saverapi.net/auth/register)** — no card needed.
|
|
69
|
+
|
|
70
|
+
**Why SaverAPI**
|
|
71
|
+
|
|
72
|
+
- **One API for every major platform** — Instagram Reels and posts, TikTok, YouTube video and MP3, Facebook, X (Twitter), Pinterest, Threads, Snapchat, Vimeo, SoundCloud and more behind a single key.
|
|
73
|
+
- **YouTube from 144p to 4K** — `2160`, `1440`, `1080`, `720`… or `mp3` audio, with no yt-dlp, ffmpeg, proxies or cookies to maintain.
|
|
74
|
+
- **Built for Telegram bots** — get a ready `file_id` for your own bot and send a YouTube video instantly, without downloading or re-uploading it.
|
|
75
|
+
- **Sync, async and CLI** — `SaverAPI` (requests), `AsyncSaverAPI` (httpx, for aiogram / FastAPI) and a `saverapi` terminal command.
|
|
76
|
+
- **Documented responses** — a real JSON sample and field table for every method, [right here](#response-reference).
|
|
77
|
+
- **Production ready** — automatic retries, typed exceptions, type hints, Python 3.8–3.13.
|
|
78
|
+
|
|
79
|
+
**Contents:** [Quick start](#quick-start) · [Supported platforms](#supported-platforms) · [Examples](#examples) · [Response reference](#response-reference) · [Async](#async-aiogram-fastapi-asyncio) · [Command line](#command-line) · [Errors and retries](#errors-and-retries) · [FAQ](#faq) · [Changelog](#changelog)
|
|
80
|
+
|
|
81
|
+
---
|
|
82
|
+
|
|
83
|
+
## Quick start
|
|
84
|
+
|
|
85
|
+
```python
|
|
86
|
+
from saverapi import SaverAPI
|
|
87
|
+
|
|
88
|
+
api = SaverAPI(api_key="YOUR_API_KEY") # or export SAVERAPI_KEY=...
|
|
89
|
+
|
|
90
|
+
media = api.download("https://www.instagram.com/reel/DPOi9V-CAqH/")
|
|
91
|
+
print(media["hosting"], media["type"], media["download_url"])
|
|
92
|
+
|
|
93
|
+
api.save_file(media["download_url"], "downloads/reel.mp4")
|
|
94
|
+
```
|
|
95
|
+
|
|
96
|
+
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.
|
|
97
|
+
|
|
98
|
+
## Supported platforms
|
|
99
|
+
|
|
100
|
+
| Platform | Method | REST endpoint |
|
|
101
|
+
|---|---|---|
|
|
102
|
+
| Instagram (posts, Reels) | `api.download(url)` | [`/all-in-one-downloader-api`](https://saverapi.net/instagram-downloader-api) |
|
|
103
|
+
| TikTok | `api.download(url)` | [`/all-in-one-downloader-api`](https://saverapi.net/tiktok-downloader-api) |
|
|
104
|
+
| Facebook | `api.download(url)` | [`/all-in-one-downloader-api`](https://saverapi.net/facebook-video-api) |
|
|
105
|
+
| Twitter / X | `api.download(url)` | [`/all-in-one-downloader-api`](https://saverapi.net/twitter-video-api) |
|
|
106
|
+
| 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) |
|
|
107
|
+
| YouTube video (144p–4K) / MP3 | `api.youtube(url, format)` | [`/youtube-api`](https://saverapi.net/youtube-downloader-api) |
|
|
108
|
+
| YouTube as a Telegram `file_id` | `api.youtube_telegram(url, format, bot_username)` | `/youtube-telegram-base` |
|
|
109
|
+
| YouTube metadata | `api.youtube_info(url)` · `api.youtube_info_basic(url)` | `/youtube-info-v2` · `/youtube-info` |
|
|
110
|
+
| Instagram profile | `api.instagram_profile(username)` | `/instagram-profile` |
|
|
111
|
+
| Shazam song recognition | `api.shazam_recognize(url)` | [`/shazam-recognize`](https://saverapi.net/shazam-api) |
|
|
112
|
+
| Shazam top charts | `api.shazam_top(country)` | `/shazam-music-top` |
|
|
113
|
+
| Music search | `api.music_search(query, limit)` | `/music-search` |
|
|
114
|
+
| NSFW scanner | `api.nsfw_scan(url)` | `/nsfw-scanner-api` |
|
|
115
|
+
| Account balance (free) | `api.info_balance()` | `/infobalans` |
|
|
116
|
+
| Key statistics (free) | `api.api_keys_statistics()` | `/api-keys/all-statistics` |
|
|
117
|
+
|
|
118
|
+
What each method returns: **[Response reference](#response-reference)** below. Live parameter reference: **[saverapi.net/docs](https://saverapi.net/docs)**. Endpoints added to the catalog later can be called with `api.request("/endpoint-path", {"param": "value"})`.
|
|
119
|
+
|
|
120
|
+
## Examples
|
|
121
|
+
|
|
122
|
+
### Download a YouTube video (up to 4K) or MP3 in Python
|
|
123
|
+
|
|
124
|
+
```python
|
|
125
|
+
video = api.youtube("https://youtu.be/OORSiK8ScTI", format="720")
|
|
126
|
+
api.save_file(video["url"], "video.mp4")
|
|
127
|
+
|
|
128
|
+
audio = api.youtube("https://youtu.be/OORSiK8ScTI", format="mp3")
|
|
129
|
+
uhd = api.youtube("https://youtu.be/OORSiK8ScTI", format="2160") # 4K, when the video has it
|
|
130
|
+
|
|
131
|
+
info = api.youtube_info("https://youtu.be/OORSiK8ScTI")
|
|
132
|
+
print(info["title"], info["duration"])
|
|
133
|
+
```
|
|
134
|
+
|
|
135
|
+
`format` is one of `2160`, `1440`, `1080`, `720`, `480`, `360`, `240`, `144` or `mp3` (also available as `saverapi.YOUTUBE_FORMATS`).
|
|
136
|
+
|
|
137
|
+
### YouTube straight into a Telegram bot (`file_id`)
|
|
138
|
+
|
|
139
|
+
Pass your bot's username and the response carries a `file_id` that is valid for that bot — send it without downloading or re-uploading anything, and store it to reuse later.
|
|
140
|
+
|
|
141
|
+
```python
|
|
142
|
+
import time
|
|
143
|
+
|
|
144
|
+
res = api.youtube_telegram("https://youtu.be/OORSiK8ScTI", format="720", bot_username="@MyBot")
|
|
145
|
+
while res.get("status") == "processing": # a new video is still being prepared
|
|
146
|
+
time.sleep(res.get("retry_after", 5))
|
|
147
|
+
res = api.youtube_telegram("https://youtu.be/OORSiK8ScTI", format="720", bot_username="@MyBot")
|
|
148
|
+
|
|
149
|
+
if res["media_type"] == "video":
|
|
150
|
+
bot.send_video(chat_id, res["file_id"]) # your Telegram library's sendVideo
|
|
151
|
+
else:
|
|
152
|
+
bot.send_audio(chat_id, res["file_id"]) # format="mp3" → sendAudio
|
|
153
|
+
```
|
|
154
|
+
|
|
155
|
+
Formats here: `1080`, `720`, `480`, `360`, `240`, `144` or `mp3`. The response also has `title`, `author`, `duration`, `size`, `width`, `height` and `thumbnail_url`. Your bot may receive service messages while the file is delivered — do not reply to them.
|
|
156
|
+
|
|
157
|
+
### Download TikTok, Instagram, Facebook or X videos
|
|
158
|
+
|
|
159
|
+
```python
|
|
160
|
+
for link in [
|
|
161
|
+
"https://www.tiktok.com/@user/video/7300000000000000000",
|
|
162
|
+
"https://www.facebook.com/watch/?v=1234567890",
|
|
163
|
+
"https://x.com/user/status/1234567890",
|
|
164
|
+
]:
|
|
165
|
+
media = api.download(link)
|
|
166
|
+
print(media["hosting"], media["download_url"])
|
|
167
|
+
```
|
|
168
|
+
|
|
169
|
+
### Instagram profile data
|
|
170
|
+
|
|
171
|
+
```python
|
|
172
|
+
profile = api.instagram_profile("cristiano")
|
|
173
|
+
print(profile["user"]["full_name"], profile["user"]["is_verified"])
|
|
174
|
+
```
|
|
175
|
+
|
|
176
|
+
### Recognise a song, search music, read charts
|
|
177
|
+
|
|
178
|
+
```python
|
|
179
|
+
song = api.shazam_recognize("https://example.com/clip.mp3")
|
|
180
|
+
print(song["track"]["title"], "—", song["track"]["subtitle"])
|
|
181
|
+
|
|
182
|
+
results = api.music_search("Hello Adele", limit=5)
|
|
183
|
+
top = api.shazam_top("united-states")
|
|
184
|
+
```
|
|
185
|
+
|
|
186
|
+
### Check your plan and credits (free)
|
|
187
|
+
|
|
188
|
+
```python
|
|
189
|
+
print(api.info_balance())
|
|
190
|
+
```
|
|
191
|
+
|
|
192
|
+
## Response reference
|
|
193
|
+
|
|
194
|
+
Every method returns the API's JSON decoded into a plain `dict`. The samples below are real responses (long URLs and lists shortened with `…`). Fields can be `null` when the source has no value, so prefer `.get()` for optional ones.
|
|
195
|
+
|
|
196
|
+
| Method | Key fields in the response |
|
|
197
|
+
|---|---|
|
|
198
|
+
| [`download()`](#download--all-in-one-downloader) | `hosting`, `type`, `download_url`, `thumb`, `caption` |
|
|
199
|
+
| [`youtube()`](#youtube--video-or-mp3) | `url`, `filename`, `title`, `author`, `width`, `height`, `thumbnail` |
|
|
200
|
+
| [`youtube_telegram()`](#youtube_telegram--telegram-file_id) | `status`, `file_id`, `media_type`, `title`, `duration`, `size` |
|
|
201
|
+
| [`youtube_info()`](#youtube_info--full-metadata) | `title`, `author`, `duration`, `thumbnails`, `formats[]` |
|
|
202
|
+
| [`youtube_info_basic()`](#youtube_info_basic--light-metadata) | `title`, `author_name`, `author_url`, `thumbnail_url` |
|
|
203
|
+
| [`instagram_profile()`](#instagram_profile) | `user{}`, `counts{}`, `stories[]`, `highlights[]`, `posts[]` |
|
|
204
|
+
| [`shazam_recognize()`](#shazam_recognize) | `track.title`, `track.subtitle`, `track.images`, `track.url` |
|
|
205
|
+
| [`shazam_top()`](#shazam_top) | `country`, `chart`, `total_songs`, `songs[]` |
|
|
206
|
+
| [`music_search()`](#music_search) | `query`, `total_results`, `results[]` |
|
|
207
|
+
| [`info_balance()`](#info_balance--free) | `plan`, `credits_remaining`, `limits{}`, `subscription{}` |
|
|
208
|
+
| [`api_keys_statistics()`](#api_keys_statistics--free) | `data[].statistics` — per period, per platform |
|
|
209
|
+
|
|
210
|
+
### `download()` — All-in-One downloader
|
|
211
|
+
|
|
212
|
+
```python
|
|
213
|
+
media = api.download("https://www.instagram.com/reel/DPOi9V-CAqH/")
|
|
214
|
+
```
|
|
215
|
+
|
|
216
|
+
```json
|
|
217
|
+
{
|
|
218
|
+
"error": false,
|
|
219
|
+
"hosting": "instagram",
|
|
220
|
+
"shortcode": null,
|
|
221
|
+
"caption": "",
|
|
222
|
+
"type": "video",
|
|
223
|
+
"download_url": "https://scontent-iad3-1.cdninstagram.com/o1/v/t2/f2/m86/AQOua1uN….mp4?…",
|
|
224
|
+
"thumb": "https://scontent-iad6-1.cdninstagram.com/v/t51.82787-15/557983269_….jpg?…"
|
|
225
|
+
}
|
|
226
|
+
```
|
|
227
|
+
|
|
228
|
+
| Field | Type | Meaning |
|
|
229
|
+
|---|---|---|
|
|
230
|
+
| `hosting` | string | Detected platform: `instagram`, `tiktok`, `facebook`, `twitter`… |
|
|
231
|
+
| `type` | string | `video` or `image` |
|
|
232
|
+
| `download_url` | string | Direct link to the media file (expires — save it right away) |
|
|
233
|
+
| `thumb` | string | Preview image |
|
|
234
|
+
| `caption` | string | Post text, when the platform provides it |
|
|
235
|
+
|
|
236
|
+
### `youtube()` — video or MP3
|
|
237
|
+
|
|
238
|
+
```python
|
|
239
|
+
video = api.youtube("https://youtu.be/OORSiK8ScTI", format="720")
|
|
240
|
+
```
|
|
241
|
+
|
|
242
|
+
```json
|
|
243
|
+
{
|
|
244
|
+
"status": "tunnel",
|
|
245
|
+
"url": "https://…/tunnel/dd9999da-6d26-46ce-85d1-128f02138f84.mp4",
|
|
246
|
+
"filename": "Музыка для души Miyagi & Эндшпиль (Hajime Records) - TheNext (720p, h264).mp4",
|
|
247
|
+
"duration": null,
|
|
248
|
+
"width": 1280,
|
|
249
|
+
"height": 720,
|
|
250
|
+
"thumbnail": "https://i.ytimg.com/vi/OORSiK8ScTI/hqdefault.jpg",
|
|
251
|
+
"title": "Музыка для души | Miyagi & Эндшпиль (#music #miyagi) (Hajime Records)",
|
|
252
|
+
"author": "TheNext"
|
|
253
|
+
}
|
|
254
|
+
```
|
|
255
|
+
|
|
256
|
+
| Field | Type | Meaning |
|
|
257
|
+
|---|---|---|
|
|
258
|
+
| `url` | string | Direct link to the video (or audio for `format="mp3"`) — pass it to `api.save_file()` |
|
|
259
|
+
| `filename` | string | Suggested file name, with quality and codec |
|
|
260
|
+
| `width`, `height` | int | Actual resolution of the returned file |
|
|
261
|
+
| `title`, `author`, `thumbnail` | string | Video title, channel name, preview image |
|
|
262
|
+
|
|
263
|
+
### `youtube_telegram()` — Telegram `file_id`
|
|
264
|
+
|
|
265
|
+
```python
|
|
266
|
+
res = api.youtube_telegram("https://youtu.be/OORSiK8ScTI", format="720", bot_username="@MyBot")
|
|
267
|
+
```
|
|
268
|
+
|
|
269
|
+
```json
|
|
270
|
+
{
|
|
271
|
+
"status": "success",
|
|
272
|
+
"youtube_id": "OORSiK8ScTI",
|
|
273
|
+
"youtube_url": "https://youtu.be/OORSiK8ScTI",
|
|
274
|
+
"title": "Музыка для души | Miyagi & Эндшпиль",
|
|
275
|
+
"author": "TheNext",
|
|
276
|
+
"thumbnail_url": "https://i.ytimg.com/vi/OORSiK8ScTI/hqdefault.jpg",
|
|
277
|
+
"format": "720",
|
|
278
|
+
"media_type": "video",
|
|
279
|
+
"size": 25948010,
|
|
280
|
+
"duration": 228,
|
|
281
|
+
"width": 1280,
|
|
282
|
+
"height": 720,
|
|
283
|
+
"bot_username": "@mybot",
|
|
284
|
+
"file_id": "BAACAgIAAxkBAAI…"
|
|
285
|
+
}
|
|
286
|
+
```
|
|
287
|
+
|
|
288
|
+
| Field | Type | Meaning |
|
|
289
|
+
|---|---|---|
|
|
290
|
+
| `status` | string | `success`, or `processing` while a new video is being prepared — then call again after `retry_after` seconds |
|
|
291
|
+
| `file_id` | string | Telegram file id valid for `bot_username` — reusable, store it |
|
|
292
|
+
| `media_type` | string | `video` → `sendVideo`, `audio` → `sendAudio` |
|
|
293
|
+
| `size` | int | File size in bytes |
|
|
294
|
+
| `duration` | int | Length in seconds |
|
|
295
|
+
|
|
296
|
+
### `youtube_info()` — full metadata
|
|
297
|
+
|
|
298
|
+
```python
|
|
299
|
+
info = api.youtube_info("https://youtu.be/bICMVAhktBE")
|
|
300
|
+
```
|
|
301
|
+
|
|
302
|
+
```json
|
|
303
|
+
{
|
|
304
|
+
"ok": true,
|
|
305
|
+
"video_id": "bICMVAhktBE",
|
|
306
|
+
"title": "Shohjahon Jo'rayev - Farishtaginam (7-studiya ko'rsatuvida)",
|
|
307
|
+
"author": "JO'RAYEVLAR",
|
|
308
|
+
"author_url": "https://www.youtube.com/channel/UCEmb9urJ-ad8p-mdtYfOJIA",
|
|
309
|
+
"thumbnail": "https://i.ytimg.com/vi/bICMVAhktBE/maxresdefault.jpg",
|
|
310
|
+
"duration": 299,
|
|
311
|
+
"thumbnails": {
|
|
312
|
+
"low": "https://i.ytimg.com/vi/bICMVAhktBE/mqdefault.jpg",
|
|
313
|
+
"max": "https://i.ytimg.com/vi/bICMVAhktBE/maxresdefault.jpg"
|
|
314
|
+
},
|
|
315
|
+
"formats": [
|
|
316
|
+
{ "type": "video", "format": "144p", "filesize": 7390784 },
|
|
317
|
+
{ "type": "video", "format": "240p", "filesize": 8901511 }
|
|
318
|
+
]
|
|
319
|
+
}
|
|
320
|
+
```
|
|
321
|
+
|
|
322
|
+
`formats` lists every quality the video has, with its size in bytes — check it before asking `youtube()` for `1440` or `2160`.
|
|
323
|
+
|
|
324
|
+
### `youtube_info_basic()` — light metadata
|
|
325
|
+
|
|
326
|
+
```python
|
|
327
|
+
info = api.youtube_info_basic("https://youtu.be/bICMVAhktBE")
|
|
328
|
+
```
|
|
329
|
+
|
|
330
|
+
```json
|
|
331
|
+
{
|
|
332
|
+
"title": "Shohjahon Jo'rayev - Farishtaginam (7-studiya ko'rsatuvida)",
|
|
333
|
+
"author_name": "JO'RAYEVLAR",
|
|
334
|
+
"author_url": "https://www.youtube.com/@jorayevlar2790",
|
|
335
|
+
"type": "video",
|
|
336
|
+
"provider_name": "YouTube",
|
|
337
|
+
"thumbnail_url": "https://i.ytimg.com/vi/bICMVAhktBE/hqdefault.jpg",
|
|
338
|
+
"thumbnail_width": 480,
|
|
339
|
+
"thumbnail_height": 360,
|
|
340
|
+
"html": "<iframe width=\"200\" height=\"113\" src=\"https://www.youtube.com/embed/bICMVAhktBE?feature=oembed\" …></iframe>"
|
|
341
|
+
}
|
|
342
|
+
```
|
|
343
|
+
|
|
344
|
+
### `instagram_profile()`
|
|
345
|
+
|
|
346
|
+
```python
|
|
347
|
+
profile = api.instagram_profile("cristiano")
|
|
348
|
+
```
|
|
349
|
+
|
|
350
|
+
```json
|
|
351
|
+
{
|
|
352
|
+
"error": false,
|
|
353
|
+
"user": {
|
|
354
|
+
"id": 173560420,
|
|
355
|
+
"username": "cristiano",
|
|
356
|
+
"full_name": "Cristiano Ronaldo",
|
|
357
|
+
"biography": "",
|
|
358
|
+
"external_url": "https://hrbl.me/CR7Pro2col",
|
|
359
|
+
"is_private": false,
|
|
360
|
+
"is_verified": true,
|
|
361
|
+
"profile_pic_url": "https://…/profile.jpg",
|
|
362
|
+
"stats": { "posts": 4121, "followers": 679697682, "following": 634 }
|
|
363
|
+
},
|
|
364
|
+
"counts": { "stories": 0, "highlights": 0, "posts": 12 },
|
|
365
|
+
"stories": [],
|
|
366
|
+
"highlights": [],
|
|
367
|
+
"posts": [
|
|
368
|
+
{ "id": "3968787288363683029_173560420", "type": "carousel", "url": "https://…/post.jpg", "taken_at": "2 days" }
|
|
369
|
+
]
|
|
370
|
+
}
|
|
371
|
+
```
|
|
372
|
+
|
|
373
|
+
### `shazam_recognize()`
|
|
374
|
+
|
|
375
|
+
```python
|
|
376
|
+
song = api.shazam_recognize("https://example.com/clip.mp3")
|
|
377
|
+
```
|
|
378
|
+
|
|
379
|
+
```json
|
|
380
|
+
{
|
|
381
|
+
"matches": [{ "id": "804915529", "offset": 2.67, "timeskew": 0.0165, "frequencyskew": 0.0028 }],
|
|
382
|
+
"track": {
|
|
383
|
+
"key": "804915529",
|
|
384
|
+
"type": "MUSIC",
|
|
385
|
+
"title": "Nowy dzień",
|
|
386
|
+
"subtitle": "YOTAGAMI",
|
|
387
|
+
"images": {
|
|
388
|
+
"coverart": "https://is1-ssl.mzstatic.com/image/thumb/Music221/…/400x400cc.jpg",
|
|
389
|
+
"coverarthq": "https://is1-ssl.mzstatic.com/image/thumb/Music221/…/400x400cc.jpg"
|
|
390
|
+
},
|
|
391
|
+
"share": { "subject": "Nowy dzień - YOTAGAMI", "href": "https://www.shazam.com/track/804915529/…" },
|
|
392
|
+
"hub": { "type": "APPLEMUSIC", "providers": [{ "type": "SPOTIFY", "caption": "Open in Spotify" }] },
|
|
393
|
+
"genres": { "primary": "Dance" },
|
|
394
|
+
"url": "https://www.shazam.com/track/804915529/…"
|
|
395
|
+
}
|
|
396
|
+
}
|
|
397
|
+
```
|
|
398
|
+
|
|
399
|
+
`track.title` is the song and `track.subtitle` the artist. When nothing is recognised, `matches` is empty and there is no `track` — use `song.get("track")`.
|
|
400
|
+
|
|
401
|
+
### `shazam_top()`
|
|
402
|
+
|
|
403
|
+
```python
|
|
404
|
+
top = api.shazam_top("united-states")
|
|
405
|
+
```
|
|
406
|
+
|
|
407
|
+
```json
|
|
408
|
+
{
|
|
409
|
+
"status": "success",
|
|
410
|
+
"country": "United States",
|
|
411
|
+
"country_code": "US",
|
|
412
|
+
"chart": "Top 200 United States",
|
|
413
|
+
"total_songs": 400,
|
|
414
|
+
"songs": [
|
|
415
|
+
{ "position": 1, "title": "Loser", "artist": "Tame Impala" }
|
|
416
|
+
]
|
|
417
|
+
}
|
|
418
|
+
```
|
|
419
|
+
|
|
420
|
+
### `music_search()`
|
|
421
|
+
|
|
422
|
+
```python
|
|
423
|
+
found = api.music_search("Hello Adele", limit=5)
|
|
424
|
+
```
|
|
425
|
+
|
|
426
|
+
```json
|
|
427
|
+
{
|
|
428
|
+
"query": "Hello Adele",
|
|
429
|
+
"total_results": 5,
|
|
430
|
+
"results": [
|
|
431
|
+
{
|
|
432
|
+
"id": "YQHsXMglC9A",
|
|
433
|
+
"title": "Adele - Hello (Official Music Video)",
|
|
434
|
+
"artist": "Adele",
|
|
435
|
+
"duration": "6:07",
|
|
436
|
+
"thumbnail": "https://i.ytimg.com/vi/YQHsXMglC9A/mqdefault.jpg",
|
|
437
|
+
"year": ""
|
|
438
|
+
}
|
|
439
|
+
]
|
|
440
|
+
}
|
|
441
|
+
```
|
|
442
|
+
|
|
443
|
+
`id` is a YouTube video id — `api.youtube(f"https://youtu.be/{item['id']}", format="mp3")` turns a search hit into an audio file.
|
|
444
|
+
|
|
445
|
+
### `info_balance()` — free
|
|
446
|
+
|
|
447
|
+
```python
|
|
448
|
+
me = api.info_balance()
|
|
449
|
+
```
|
|
450
|
+
|
|
451
|
+
```json
|
|
452
|
+
{
|
|
453
|
+
"success": true,
|
|
454
|
+
"owner": "you@example.com",
|
|
455
|
+
"plan": { "name": "Pro" },
|
|
456
|
+
"credits_total": 100000,
|
|
457
|
+
"credits_remaining": 87350,
|
|
458
|
+
"credits_used": 12650,
|
|
459
|
+
"credits_used_percent": 12.7,
|
|
460
|
+
"limits": { "requests_per_second": 10, "requests_per_hour": 0, "requests_per_day": 0 },
|
|
461
|
+
"subscription": {
|
|
462
|
+
"purchased_at": "2026-11-01T09:00:00.000Z",
|
|
463
|
+
"expires_at": "2026-12-01T09:00:00.000Z",
|
|
464
|
+
"days_remaining": 7
|
|
465
|
+
}
|
|
466
|
+
}
|
|
467
|
+
```
|
|
468
|
+
|
|
469
|
+
A limit of `0` means unlimited. The answer is cached for up to 10 minutes.
|
|
470
|
+
|
|
471
|
+
### `api_keys_statistics()` — free
|
|
472
|
+
|
|
473
|
+
```python
|
|
474
|
+
stats = api.api_keys_statistics()
|
|
475
|
+
```
|
|
476
|
+
|
|
477
|
+
```json
|
|
478
|
+
{
|
|
479
|
+
"success": true,
|
|
480
|
+
"data": [
|
|
481
|
+
{
|
|
482
|
+
"apiKeyId": "cm…",
|
|
483
|
+
"apiKeyName": "Production",
|
|
484
|
+
"apiKey": "abcd1234efgh5678ijkl...",
|
|
485
|
+
"createdAt": "2026-09-01T10:00:00.000Z",
|
|
486
|
+
"statistics": {
|
|
487
|
+
"timePeriod": { "hourly": 42, "daily": 910, "weekly": 6120, "monthly": 25400, "total": 181300 },
|
|
488
|
+
"requests": { "success": 178900, "failed": 2400, "successRate": 98.7 },
|
|
489
|
+
"platforms": {
|
|
490
|
+
"YouTube": { "total": 90500, "success": 89600, "failed": 900, "hourly": 20, "daily": 450, "weekly": 3000, "monthly": 12600, "successRate": 99.0 },
|
|
491
|
+
"Instagram": { "total": 60100, "success": 59200, "failed": 900, "hourly": 15, "daily": 300, "weekly": 2100, "monthly": 8400, "successRate": 98.5 }
|
|
492
|
+
}
|
|
493
|
+
}
|
|
494
|
+
}
|
|
495
|
+
],
|
|
496
|
+
"cached": false,
|
|
497
|
+
"computedAt": "2026-11-24T05:00:00.000Z"
|
|
498
|
+
}
|
|
499
|
+
```
|
|
500
|
+
|
|
501
|
+
Statistics are cached for up to an hour. The two account samples above use illustrative numbers.
|
|
502
|
+
|
|
503
|
+
### `nsfw_scan()`
|
|
504
|
+
|
|
505
|
+
```python
|
|
506
|
+
verdict = api.nsfw_scan("https://example.com/image.jpg")
|
|
507
|
+
```
|
|
508
|
+
|
|
509
|
+
Returns the scanner's verdict for the image or video as JSON; the live sample is in the [API docs](https://saverapi.net/docs).
|
|
510
|
+
|
|
511
|
+
### Errors
|
|
512
|
+
|
|
513
|
+
A failed call raises an exception (see [Errors and retries](#errors-and-retries)); the API's JSON body is kept on it:
|
|
514
|
+
|
|
515
|
+
```python
|
|
516
|
+
try:
|
|
517
|
+
api.download("https://www.instagram.com/p/private/")
|
|
518
|
+
except SaverAPIError as exc:
|
|
519
|
+
print(exc.status_code) # e.g. 400
|
|
520
|
+
print(exc.message) # "…"
|
|
521
|
+
print(exc.payload) # {"message": "…"}
|
|
522
|
+
```
|
|
523
|
+
|
|
524
|
+
## Async (aiogram, FastAPI, asyncio)
|
|
525
|
+
|
|
526
|
+
```python
|
|
527
|
+
import asyncio
|
|
528
|
+
from saverapi import AsyncSaverAPI
|
|
529
|
+
|
|
530
|
+
async def main():
|
|
531
|
+
async with AsyncSaverAPI() as api: # reads SAVERAPI_KEY
|
|
532
|
+
results = await asyncio.gather(
|
|
533
|
+
api.download("https://www.instagram.com/reel/DPOi9V-CAqH/"),
|
|
534
|
+
api.youtube_info("https://youtu.be/OORSiK8ScTI"),
|
|
535
|
+
)
|
|
536
|
+
print(results)
|
|
537
|
+
|
|
538
|
+
asyncio.run(main())
|
|
539
|
+
```
|
|
540
|
+
|
|
541
|
+
### Telegram downloader bot (aiogram 3)
|
|
542
|
+
|
|
543
|
+
```python
|
|
544
|
+
from aiogram import Bot, Dispatcher, F
|
|
545
|
+
from aiogram.types import Message
|
|
546
|
+
from saverapi import AsyncSaverAPI, SaverAPIError
|
|
547
|
+
|
|
548
|
+
bot = Bot("TELEGRAM_BOT_TOKEN")
|
|
549
|
+
dp = Dispatcher()
|
|
550
|
+
api = AsyncSaverAPI() # SAVERAPI_KEY from the environment
|
|
551
|
+
|
|
552
|
+
@dp.message(F.text.startswith("http"))
|
|
553
|
+
async def on_link(message: Message):
|
|
554
|
+
try:
|
|
555
|
+
media = await api.download(message.text.strip())
|
|
556
|
+
except SaverAPIError as exc:
|
|
557
|
+
await message.answer(f"Could not download: {exc.message}")
|
|
558
|
+
return
|
|
559
|
+
if media.get("type") == "image":
|
|
560
|
+
await message.answer_photo(media["download_url"])
|
|
561
|
+
else:
|
|
562
|
+
await message.answer_video(media["download_url"])
|
|
563
|
+
|
|
564
|
+
dp.run_polling(bot)
|
|
565
|
+
```
|
|
566
|
+
|
|
567
|
+
Step-by-step guide: **[Build a Telegram video downloader bot](https://saverapi.net/blog/build-telegram-video-downloader-bot)**.
|
|
568
|
+
|
|
569
|
+
## Command line
|
|
570
|
+
|
|
571
|
+
```bash
|
|
572
|
+
export SAVERAPI_KEY=your_key
|
|
573
|
+
saverapi download https://www.instagram.com/reel/DPOi9V-CAqH/
|
|
574
|
+
saverapi youtube https://youtu.be/OORSiK8ScTI --format mp3
|
|
575
|
+
saverapi youtube-telegram https://youtu.be/OORSiK8ScTI --bot @MyBot
|
|
576
|
+
saverapi youtube-info https://youtu.be/OORSiK8ScTI
|
|
577
|
+
saverapi instagram cristiano
|
|
578
|
+
saverapi shazam https://example.com/clip.mp3
|
|
579
|
+
saverapi balance
|
|
580
|
+
```
|
|
581
|
+
|
|
582
|
+
Prints the JSON response; exits with status 1 on an API error.
|
|
583
|
+
|
|
584
|
+
## Errors and retries
|
|
585
|
+
|
|
586
|
+
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:
|
|
587
|
+
|
|
588
|
+
```python
|
|
589
|
+
from saverapi import (
|
|
590
|
+
SaverAPIError, AuthenticationError, InsufficientCreditsError,
|
|
591
|
+
RateLimitError, NotFoundError, ServerError, NetworkError,
|
|
592
|
+
)
|
|
593
|
+
|
|
594
|
+
try:
|
|
595
|
+
api.download(link)
|
|
596
|
+
except AuthenticationError: # 401/403 — wrong or disabled key
|
|
597
|
+
...
|
|
598
|
+
except InsufficientCreditsError: # 402 — top up or upgrade at saverapi.net/pricing
|
|
599
|
+
...
|
|
600
|
+
except RateLimitError as exc: # 429 after retries
|
|
601
|
+
...
|
|
602
|
+
except SaverAPIError as exc: # anything else; exc.status_code, exc.message, exc.payload
|
|
603
|
+
...
|
|
604
|
+
```
|
|
605
|
+
|
|
606
|
+
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.
|
|
607
|
+
|
|
608
|
+
## Tips
|
|
609
|
+
|
|
610
|
+
- Media links (`download_url`) come from the networks' CDNs and **expire** — download them right after the call.
|
|
611
|
+
- Only public content can be resolved; private accounts and deleted posts fail.
|
|
612
|
+
- Keep the API key on your server; mobile and web apps should call your backend.
|
|
613
|
+
- Respect each platform's terms of service and creators' rights.
|
|
614
|
+
|
|
615
|
+
## FAQ
|
|
616
|
+
|
|
617
|
+
**How do I download a YouTube video in Python?**
|
|
618
|
+
Install `saverapi-client`, then call `api.youtube(url, format="720")` and save `video["url"]` with `api.save_file(...)`. No yt-dlp or ffmpeg is needed — the API does the work. See the [YouTube Downloader API](https://saverapi.net/youtube-downloader-api) page.
|
|
619
|
+
|
|
620
|
+
**Can I download YouTube in 4K or 1440p?**
|
|
621
|
+
Yes: `format="2160"` (4K) and `format="1440"` (2K) are supported alongside 1080, 720, 480, 360, 240 and 144, when the video has that quality.
|
|
622
|
+
|
|
623
|
+
**How do I convert YouTube to MP3?**
|
|
624
|
+
`api.youtube(url, format="mp3")` returns a link to the audio file.
|
|
625
|
+
|
|
626
|
+
**How do I download Instagram Reels or TikTok videos in Python?**
|
|
627
|
+
`api.download(link)` works for Instagram posts and Reels, TikTok, Facebook, X and the other supported networks — the platform is detected from the link. See the [Instagram](https://saverapi.net/instagram-downloader-api) and [TikTok](https://saverapi.net/tiktok-downloader-api) API pages.
|
|
628
|
+
|
|
629
|
+
**How do I send a YouTube video from a Telegram bot without uploading it?**
|
|
630
|
+
Call `api.youtube_telegram(url, format, bot_username="@YourBot")` and pass the returned `file_id` to `sendVideo` / `sendAudio`. Works with aiogram, python-telegram-bot, pyTelegramBotAPI and any other library.
|
|
631
|
+
|
|
632
|
+
**Is there a free plan?**
|
|
633
|
+
Yes — register at [saverapi.net](https://saverapi.net/auth/register) for a free key; paid plans and pay-as-you-go credits are on the [pricing](https://saverapi.net/pricing) page.
|
|
634
|
+
|
|
635
|
+
**Does it work with asyncio?**
|
|
636
|
+
Yes: `pip install "saverapi-client[async]"` and use `AsyncSaverAPI` — same methods, awaited.
|
|
637
|
+
|
|
638
|
+
## Links
|
|
639
|
+
|
|
640
|
+
- Website and free API key: https://saverapi.net
|
|
641
|
+
- API documentation: https://saverapi.net/docs
|
|
642
|
+
- YouTube Downloader API: https://saverapi.net/youtube-downloader-api
|
|
643
|
+
- Instagram Downloader API: https://saverapi.net/instagram-downloader-api
|
|
644
|
+
- TikTok Downloader API: https://saverapi.net/tiktok-downloader-api
|
|
645
|
+
- Facebook Video API: https://saverapi.net/facebook-video-api
|
|
646
|
+
- Twitter / X Video API: https://saverapi.net/twitter-video-api
|
|
647
|
+
- Shazam Song Recognition API: https://saverapi.net/shazam-api
|
|
648
|
+
- Social Media Downloader API: https://saverapi.net/social-media-downloader-api
|
|
649
|
+
- All-in-One Downloader API: https://saverapi.net/all-in-one-downloader-api
|
|
650
|
+
- Tutorials: https://saverapi.net/blog
|
|
651
|
+
- [YouTube downloader API in Python](https://saverapi.net/blog/youtube-downloader-api-python)
|
|
652
|
+
- [Build a Telegram YouTube downloader bot](https://saverapi.net/blog/build-telegram-youtube-downloader-bot)
|
|
653
|
+
- [Download Instagram Reels with Python](https://saverapi.net/blog/download-instagram-reels-python)
|
|
654
|
+
- [A yt-dlp API alternative](https://saverapi.net/blog/yt-dlp-api-alternative)
|
|
655
|
+
- Pricing: https://saverapi.net/pricing
|
|
656
|
+
- Telegram: https://t.me/SaverAPI
|
|
657
|
+
|
|
658
|
+
## Changelog
|
|
659
|
+
|
|
660
|
+
**2.0.1**
|
|
661
|
+
- Documentation: new **Response reference** — a real JSON sample and key-field table for every method. No code changes.
|
|
662
|
+
|
|
663
|
+
**2.0.0**
|
|
664
|
+
- YouTube: `api.youtube()` now documents the new `2160` (4K) and `1440` (2K) formats; the full list is exported as `YOUTUBE_FORMATS`.
|
|
665
|
+
- YouTube for Telegram: `api.youtube_telegram(url, format, bot_username="@MyBot")` returns a ready `file_id` for your bot. New CLI command `saverapi youtube-telegram URL --bot @MyBot`.
|
|
666
|
+
- **Removed** `youtube_subtitles()` and `photolab()` (and the `saverapi subtitles` command): the `/youtube-subtitles` and `/photolab-api` endpoints were retired from the API and already answered 404. This is the only breaking change — if you do not call these two methods, upgrading from 1.x needs no code changes.
|
|
667
|
+
- `format` accepts an `int` as well as a `str` in type hints (`format=720`).
|
|
668
|
+
|
|
669
|
+
**1.1.0**
|
|
670
|
+
- New methods covering the whole catalog: `youtube_telegram`, `youtube_info_basic`, `youtube_subtitles`, `instagram_profile`, `photolab`, and `request()` for any endpoint.
|
|
671
|
+
- `AsyncSaverAPI` for asyncio (`pip install "saverapi-client[async]"`).
|
|
672
|
+
- `saverapi` command line tool.
|
|
673
|
+
- Automatic retries with backoff for 429 and 5xx; specific exception classes.
|
|
674
|
+
- API key from the `SAVERAPI_KEY` environment variable; context-manager support; type hints (`py.typed`).
|
|
675
|
+
- Fully backwards compatible with 1.0.x.
|
|
676
|
+
|
|
677
|
+
## License
|
|
678
|
+
|
|
679
|
+
MIT © SaverAPI.NET
|