saverapi-client 2.0.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.0/saverapi_client.egg-info → saverapi_client-2.0.1}/PKG-INFO +339 -3
- {saverapi_client-2.0.0 → saverapi_client-2.0.1}/README.md +338 -2
- saverapi_client-2.0.1/saverapi/_version.py +1 -0
- {saverapi_client-2.0.0 → saverapi_client-2.0.1/saverapi_client.egg-info}/PKG-INFO +339 -3
- {saverapi_client-2.0.0 → saverapi_client-2.0.1}/tests/test_client.py +1 -1
- saverapi_client-2.0.0/saverapi/_version.py +0 -1
- {saverapi_client-2.0.0 → saverapi_client-2.0.1}/LICENSE +0 -0
- {saverapi_client-2.0.0 → saverapi_client-2.0.1}/pyproject.toml +0 -0
- {saverapi_client-2.0.0 → saverapi_client-2.0.1}/saverapi/__init__.py +0 -0
- {saverapi_client-2.0.0 → saverapi_client-2.0.1}/saverapi/async_client.py +0 -0
- {saverapi_client-2.0.0 → saverapi_client-2.0.1}/saverapi/cli.py +0 -0
- {saverapi_client-2.0.0 → saverapi_client-2.0.1}/saverapi/client.py +0 -0
- {saverapi_client-2.0.0 → saverapi_client-2.0.1}/saverapi/exceptions.py +0 -0
- {saverapi_client-2.0.0 → saverapi_client-2.0.1}/saverapi/py.typed +0 -0
- {saverapi_client-2.0.0 → saverapi_client-2.0.1}/saverapi_client.egg-info/SOURCES.txt +0 -0
- {saverapi_client-2.0.0 → saverapi_client-2.0.1}/saverapi_client.egg-info/dependency_links.txt +0 -0
- {saverapi_client-2.0.0 → saverapi_client-2.0.1}/saverapi_client.egg-info/entry_points.txt +0 -0
- {saverapi_client-2.0.0 → saverapi_client-2.0.1}/saverapi_client.egg-info/requires.txt +0 -0
- {saverapi_client-2.0.0 → saverapi_client-2.0.1}/saverapi_client.egg-info/top_level.txt +0 -0
- {saverapi_client-2.0.0 → saverapi_client-2.0.1}/setup.cfg +0 -0
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.4
|
|
2
2
|
Name: saverapi-client
|
|
3
|
-
Version: 2.0.
|
|
3
|
+
Version: 2.0.1
|
|
4
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
5
|
Author-email: "SaverAPI.NET" <saverapinet@gmail.com>
|
|
6
6
|
License: MIT
|
|
@@ -73,9 +73,10 @@ Get a free API key at **[saverapi.net](https://saverapi.net/auth/register)** —
|
|
|
73
73
|
- **YouTube from 144p to 4K** — `2160`, `1440`, `1080`, `720`… or `mp3` audio, with no yt-dlp, ffmpeg, proxies or cookies to maintain.
|
|
74
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
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).
|
|
76
77
|
- **Production ready** — automatic retries, typed exceptions, type hints, Python 3.8–3.13.
|
|
77
78
|
|
|
78
|
-
**Contents:** [Quick start](#quick-start) · [Supported platforms](#supported-platforms) · [Examples](#examples) · [Async](#async-aiogram-fastapi-asyncio) · [Command line](#command-line) · [Errors and retries](#errors-and-retries) · [FAQ](#faq) · [Changelog](#changelog)
|
|
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)
|
|
79
80
|
|
|
80
81
|
---
|
|
81
82
|
|
|
@@ -114,7 +115,7 @@ One call, one parameter: the **All-in-One downloader** recognises the platform f
|
|
|
114
115
|
| Account balance (free) | `api.info_balance()` | `/infobalans` |
|
|
115
116
|
| Key statistics (free) | `api.api_keys_statistics()` | `/api-keys/all-statistics` |
|
|
116
117
|
|
|
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"})`.
|
|
118
119
|
|
|
119
120
|
## Examples
|
|
120
121
|
|
|
@@ -188,6 +189,338 @@ top = api.shazam_top("united-states")
|
|
|
188
189
|
print(api.info_balance())
|
|
189
190
|
```
|
|
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
|
+
|
|
191
524
|
## Async (aiogram, FastAPI, asyncio)
|
|
192
525
|
|
|
193
526
|
```python
|
|
@@ -324,6 +657,9 @@ Yes: `pip install "saverapi-client[async]"` and use `AsyncSaverAPI` — same met
|
|
|
324
657
|
|
|
325
658
|
## Changelog
|
|
326
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
|
+
|
|
327
663
|
**2.0.0**
|
|
328
664
|
- YouTube: `api.youtube()` now documents the new `2160` (4K) and `1440` (2K) formats; the full list is exported as `YOUTUBE_FORMATS`.
|
|
329
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`.
|
|
@@ -28,9 +28,10 @@ Get a free API key at **[saverapi.net](https://saverapi.net/auth/register)** —
|
|
|
28
28
|
- **YouTube from 144p to 4K** — `2160`, `1440`, `1080`, `720`… or `mp3` audio, with no yt-dlp, ffmpeg, proxies or cookies to maintain.
|
|
29
29
|
- **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.
|
|
30
30
|
- **Sync, async and CLI** — `SaverAPI` (requests), `AsyncSaverAPI` (httpx, for aiogram / FastAPI) and a `saverapi` terminal command.
|
|
31
|
+
- **Documented responses** — a real JSON sample and field table for every method, [right here](#response-reference).
|
|
31
32
|
- **Production ready** — automatic retries, typed exceptions, type hints, Python 3.8–3.13.
|
|
32
33
|
|
|
33
|
-
**Contents:** [Quick start](#quick-start) · [Supported platforms](#supported-platforms) · [Examples](#examples) · [Async](#async-aiogram-fastapi-asyncio) · [Command line](#command-line) · [Errors and retries](#errors-and-retries) · [FAQ](#faq) · [Changelog](#changelog)
|
|
34
|
+
**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)
|
|
34
35
|
|
|
35
36
|
---
|
|
36
37
|
|
|
@@ -69,7 +70,7 @@ One call, one parameter: the **All-in-One downloader** recognises the platform f
|
|
|
69
70
|
| Account balance (free) | `api.info_balance()` | `/infobalans` |
|
|
70
71
|
| Key statistics (free) | `api.api_keys_statistics()` | `/api-keys/all-statistics` |
|
|
71
72
|
|
|
72
|
-
|
|
73
|
+
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"})`.
|
|
73
74
|
|
|
74
75
|
## Examples
|
|
75
76
|
|
|
@@ -143,6 +144,338 @@ top = api.shazam_top("united-states")
|
|
|
143
144
|
print(api.info_balance())
|
|
144
145
|
```
|
|
145
146
|
|
|
147
|
+
## Response reference
|
|
148
|
+
|
|
149
|
+
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.
|
|
150
|
+
|
|
151
|
+
| Method | Key fields in the response |
|
|
152
|
+
|---|---|
|
|
153
|
+
| [`download()`](#download--all-in-one-downloader) | `hosting`, `type`, `download_url`, `thumb`, `caption` |
|
|
154
|
+
| [`youtube()`](#youtube--video-or-mp3) | `url`, `filename`, `title`, `author`, `width`, `height`, `thumbnail` |
|
|
155
|
+
| [`youtube_telegram()`](#youtube_telegram--telegram-file_id) | `status`, `file_id`, `media_type`, `title`, `duration`, `size` |
|
|
156
|
+
| [`youtube_info()`](#youtube_info--full-metadata) | `title`, `author`, `duration`, `thumbnails`, `formats[]` |
|
|
157
|
+
| [`youtube_info_basic()`](#youtube_info_basic--light-metadata) | `title`, `author_name`, `author_url`, `thumbnail_url` |
|
|
158
|
+
| [`instagram_profile()`](#instagram_profile) | `user{}`, `counts{}`, `stories[]`, `highlights[]`, `posts[]` |
|
|
159
|
+
| [`shazam_recognize()`](#shazam_recognize) | `track.title`, `track.subtitle`, `track.images`, `track.url` |
|
|
160
|
+
| [`shazam_top()`](#shazam_top) | `country`, `chart`, `total_songs`, `songs[]` |
|
|
161
|
+
| [`music_search()`](#music_search) | `query`, `total_results`, `results[]` |
|
|
162
|
+
| [`info_balance()`](#info_balance--free) | `plan`, `credits_remaining`, `limits{}`, `subscription{}` |
|
|
163
|
+
| [`api_keys_statistics()`](#api_keys_statistics--free) | `data[].statistics` — per period, per platform |
|
|
164
|
+
|
|
165
|
+
### `download()` — All-in-One downloader
|
|
166
|
+
|
|
167
|
+
```python
|
|
168
|
+
media = api.download("https://www.instagram.com/reel/DPOi9V-CAqH/")
|
|
169
|
+
```
|
|
170
|
+
|
|
171
|
+
```json
|
|
172
|
+
{
|
|
173
|
+
"error": false,
|
|
174
|
+
"hosting": "instagram",
|
|
175
|
+
"shortcode": null,
|
|
176
|
+
"caption": "",
|
|
177
|
+
"type": "video",
|
|
178
|
+
"download_url": "https://scontent-iad3-1.cdninstagram.com/o1/v/t2/f2/m86/AQOua1uN….mp4?…",
|
|
179
|
+
"thumb": "https://scontent-iad6-1.cdninstagram.com/v/t51.82787-15/557983269_….jpg?…"
|
|
180
|
+
}
|
|
181
|
+
```
|
|
182
|
+
|
|
183
|
+
| Field | Type | Meaning |
|
|
184
|
+
|---|---|---|
|
|
185
|
+
| `hosting` | string | Detected platform: `instagram`, `tiktok`, `facebook`, `twitter`… |
|
|
186
|
+
| `type` | string | `video` or `image` |
|
|
187
|
+
| `download_url` | string | Direct link to the media file (expires — save it right away) |
|
|
188
|
+
| `thumb` | string | Preview image |
|
|
189
|
+
| `caption` | string | Post text, when the platform provides it |
|
|
190
|
+
|
|
191
|
+
### `youtube()` — video or MP3
|
|
192
|
+
|
|
193
|
+
```python
|
|
194
|
+
video = api.youtube("https://youtu.be/OORSiK8ScTI", format="720")
|
|
195
|
+
```
|
|
196
|
+
|
|
197
|
+
```json
|
|
198
|
+
{
|
|
199
|
+
"status": "tunnel",
|
|
200
|
+
"url": "https://…/tunnel/dd9999da-6d26-46ce-85d1-128f02138f84.mp4",
|
|
201
|
+
"filename": "Музыка для души Miyagi & Эндшпиль (Hajime Records) - TheNext (720p, h264).mp4",
|
|
202
|
+
"duration": null,
|
|
203
|
+
"width": 1280,
|
|
204
|
+
"height": 720,
|
|
205
|
+
"thumbnail": "https://i.ytimg.com/vi/OORSiK8ScTI/hqdefault.jpg",
|
|
206
|
+
"title": "Музыка для души | Miyagi & Эндшпиль (#music #miyagi) (Hajime Records)",
|
|
207
|
+
"author": "TheNext"
|
|
208
|
+
}
|
|
209
|
+
```
|
|
210
|
+
|
|
211
|
+
| Field | Type | Meaning |
|
|
212
|
+
|---|---|---|
|
|
213
|
+
| `url` | string | Direct link to the video (or audio for `format="mp3"`) — pass it to `api.save_file()` |
|
|
214
|
+
| `filename` | string | Suggested file name, with quality and codec |
|
|
215
|
+
| `width`, `height` | int | Actual resolution of the returned file |
|
|
216
|
+
| `title`, `author`, `thumbnail` | string | Video title, channel name, preview image |
|
|
217
|
+
|
|
218
|
+
### `youtube_telegram()` — Telegram `file_id`
|
|
219
|
+
|
|
220
|
+
```python
|
|
221
|
+
res = api.youtube_telegram("https://youtu.be/OORSiK8ScTI", format="720", bot_username="@MyBot")
|
|
222
|
+
```
|
|
223
|
+
|
|
224
|
+
```json
|
|
225
|
+
{
|
|
226
|
+
"status": "success",
|
|
227
|
+
"youtube_id": "OORSiK8ScTI",
|
|
228
|
+
"youtube_url": "https://youtu.be/OORSiK8ScTI",
|
|
229
|
+
"title": "Музыка для души | Miyagi & Эндшпиль",
|
|
230
|
+
"author": "TheNext",
|
|
231
|
+
"thumbnail_url": "https://i.ytimg.com/vi/OORSiK8ScTI/hqdefault.jpg",
|
|
232
|
+
"format": "720",
|
|
233
|
+
"media_type": "video",
|
|
234
|
+
"size": 25948010,
|
|
235
|
+
"duration": 228,
|
|
236
|
+
"width": 1280,
|
|
237
|
+
"height": 720,
|
|
238
|
+
"bot_username": "@mybot",
|
|
239
|
+
"file_id": "BAACAgIAAxkBAAI…"
|
|
240
|
+
}
|
|
241
|
+
```
|
|
242
|
+
|
|
243
|
+
| Field | Type | Meaning |
|
|
244
|
+
|---|---|---|
|
|
245
|
+
| `status` | string | `success`, or `processing` while a new video is being prepared — then call again after `retry_after` seconds |
|
|
246
|
+
| `file_id` | string | Telegram file id valid for `bot_username` — reusable, store it |
|
|
247
|
+
| `media_type` | string | `video` → `sendVideo`, `audio` → `sendAudio` |
|
|
248
|
+
| `size` | int | File size in bytes |
|
|
249
|
+
| `duration` | int | Length in seconds |
|
|
250
|
+
|
|
251
|
+
### `youtube_info()` — full metadata
|
|
252
|
+
|
|
253
|
+
```python
|
|
254
|
+
info = api.youtube_info("https://youtu.be/bICMVAhktBE")
|
|
255
|
+
```
|
|
256
|
+
|
|
257
|
+
```json
|
|
258
|
+
{
|
|
259
|
+
"ok": true,
|
|
260
|
+
"video_id": "bICMVAhktBE",
|
|
261
|
+
"title": "Shohjahon Jo'rayev - Farishtaginam (7-studiya ko'rsatuvida)",
|
|
262
|
+
"author": "JO'RAYEVLAR",
|
|
263
|
+
"author_url": "https://www.youtube.com/channel/UCEmb9urJ-ad8p-mdtYfOJIA",
|
|
264
|
+
"thumbnail": "https://i.ytimg.com/vi/bICMVAhktBE/maxresdefault.jpg",
|
|
265
|
+
"duration": 299,
|
|
266
|
+
"thumbnails": {
|
|
267
|
+
"low": "https://i.ytimg.com/vi/bICMVAhktBE/mqdefault.jpg",
|
|
268
|
+
"max": "https://i.ytimg.com/vi/bICMVAhktBE/maxresdefault.jpg"
|
|
269
|
+
},
|
|
270
|
+
"formats": [
|
|
271
|
+
{ "type": "video", "format": "144p", "filesize": 7390784 },
|
|
272
|
+
{ "type": "video", "format": "240p", "filesize": 8901511 }
|
|
273
|
+
]
|
|
274
|
+
}
|
|
275
|
+
```
|
|
276
|
+
|
|
277
|
+
`formats` lists every quality the video has, with its size in bytes — check it before asking `youtube()` for `1440` or `2160`.
|
|
278
|
+
|
|
279
|
+
### `youtube_info_basic()` — light metadata
|
|
280
|
+
|
|
281
|
+
```python
|
|
282
|
+
info = api.youtube_info_basic("https://youtu.be/bICMVAhktBE")
|
|
283
|
+
```
|
|
284
|
+
|
|
285
|
+
```json
|
|
286
|
+
{
|
|
287
|
+
"title": "Shohjahon Jo'rayev - Farishtaginam (7-studiya ko'rsatuvida)",
|
|
288
|
+
"author_name": "JO'RAYEVLAR",
|
|
289
|
+
"author_url": "https://www.youtube.com/@jorayevlar2790",
|
|
290
|
+
"type": "video",
|
|
291
|
+
"provider_name": "YouTube",
|
|
292
|
+
"thumbnail_url": "https://i.ytimg.com/vi/bICMVAhktBE/hqdefault.jpg",
|
|
293
|
+
"thumbnail_width": 480,
|
|
294
|
+
"thumbnail_height": 360,
|
|
295
|
+
"html": "<iframe width=\"200\" height=\"113\" src=\"https://www.youtube.com/embed/bICMVAhktBE?feature=oembed\" …></iframe>"
|
|
296
|
+
}
|
|
297
|
+
```
|
|
298
|
+
|
|
299
|
+
### `instagram_profile()`
|
|
300
|
+
|
|
301
|
+
```python
|
|
302
|
+
profile = api.instagram_profile("cristiano")
|
|
303
|
+
```
|
|
304
|
+
|
|
305
|
+
```json
|
|
306
|
+
{
|
|
307
|
+
"error": false,
|
|
308
|
+
"user": {
|
|
309
|
+
"id": 173560420,
|
|
310
|
+
"username": "cristiano",
|
|
311
|
+
"full_name": "Cristiano Ronaldo",
|
|
312
|
+
"biography": "",
|
|
313
|
+
"external_url": "https://hrbl.me/CR7Pro2col",
|
|
314
|
+
"is_private": false,
|
|
315
|
+
"is_verified": true,
|
|
316
|
+
"profile_pic_url": "https://…/profile.jpg",
|
|
317
|
+
"stats": { "posts": 4121, "followers": 679697682, "following": 634 }
|
|
318
|
+
},
|
|
319
|
+
"counts": { "stories": 0, "highlights": 0, "posts": 12 },
|
|
320
|
+
"stories": [],
|
|
321
|
+
"highlights": [],
|
|
322
|
+
"posts": [
|
|
323
|
+
{ "id": "3968787288363683029_173560420", "type": "carousel", "url": "https://…/post.jpg", "taken_at": "2 days" }
|
|
324
|
+
]
|
|
325
|
+
}
|
|
326
|
+
```
|
|
327
|
+
|
|
328
|
+
### `shazam_recognize()`
|
|
329
|
+
|
|
330
|
+
```python
|
|
331
|
+
song = api.shazam_recognize("https://example.com/clip.mp3")
|
|
332
|
+
```
|
|
333
|
+
|
|
334
|
+
```json
|
|
335
|
+
{
|
|
336
|
+
"matches": [{ "id": "804915529", "offset": 2.67, "timeskew": 0.0165, "frequencyskew": 0.0028 }],
|
|
337
|
+
"track": {
|
|
338
|
+
"key": "804915529",
|
|
339
|
+
"type": "MUSIC",
|
|
340
|
+
"title": "Nowy dzień",
|
|
341
|
+
"subtitle": "YOTAGAMI",
|
|
342
|
+
"images": {
|
|
343
|
+
"coverart": "https://is1-ssl.mzstatic.com/image/thumb/Music221/…/400x400cc.jpg",
|
|
344
|
+
"coverarthq": "https://is1-ssl.mzstatic.com/image/thumb/Music221/…/400x400cc.jpg"
|
|
345
|
+
},
|
|
346
|
+
"share": { "subject": "Nowy dzień - YOTAGAMI", "href": "https://www.shazam.com/track/804915529/…" },
|
|
347
|
+
"hub": { "type": "APPLEMUSIC", "providers": [{ "type": "SPOTIFY", "caption": "Open in Spotify" }] },
|
|
348
|
+
"genres": { "primary": "Dance" },
|
|
349
|
+
"url": "https://www.shazam.com/track/804915529/…"
|
|
350
|
+
}
|
|
351
|
+
}
|
|
352
|
+
```
|
|
353
|
+
|
|
354
|
+
`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")`.
|
|
355
|
+
|
|
356
|
+
### `shazam_top()`
|
|
357
|
+
|
|
358
|
+
```python
|
|
359
|
+
top = api.shazam_top("united-states")
|
|
360
|
+
```
|
|
361
|
+
|
|
362
|
+
```json
|
|
363
|
+
{
|
|
364
|
+
"status": "success",
|
|
365
|
+
"country": "United States",
|
|
366
|
+
"country_code": "US",
|
|
367
|
+
"chart": "Top 200 United States",
|
|
368
|
+
"total_songs": 400,
|
|
369
|
+
"songs": [
|
|
370
|
+
{ "position": 1, "title": "Loser", "artist": "Tame Impala" }
|
|
371
|
+
]
|
|
372
|
+
}
|
|
373
|
+
```
|
|
374
|
+
|
|
375
|
+
### `music_search()`
|
|
376
|
+
|
|
377
|
+
```python
|
|
378
|
+
found = api.music_search("Hello Adele", limit=5)
|
|
379
|
+
```
|
|
380
|
+
|
|
381
|
+
```json
|
|
382
|
+
{
|
|
383
|
+
"query": "Hello Adele",
|
|
384
|
+
"total_results": 5,
|
|
385
|
+
"results": [
|
|
386
|
+
{
|
|
387
|
+
"id": "YQHsXMglC9A",
|
|
388
|
+
"title": "Adele - Hello (Official Music Video)",
|
|
389
|
+
"artist": "Adele",
|
|
390
|
+
"duration": "6:07",
|
|
391
|
+
"thumbnail": "https://i.ytimg.com/vi/YQHsXMglC9A/mqdefault.jpg",
|
|
392
|
+
"year": ""
|
|
393
|
+
}
|
|
394
|
+
]
|
|
395
|
+
}
|
|
396
|
+
```
|
|
397
|
+
|
|
398
|
+
`id` is a YouTube video id — `api.youtube(f"https://youtu.be/{item['id']}", format="mp3")` turns a search hit into an audio file.
|
|
399
|
+
|
|
400
|
+
### `info_balance()` — free
|
|
401
|
+
|
|
402
|
+
```python
|
|
403
|
+
me = api.info_balance()
|
|
404
|
+
```
|
|
405
|
+
|
|
406
|
+
```json
|
|
407
|
+
{
|
|
408
|
+
"success": true,
|
|
409
|
+
"owner": "you@example.com",
|
|
410
|
+
"plan": { "name": "Pro" },
|
|
411
|
+
"credits_total": 100000,
|
|
412
|
+
"credits_remaining": 87350,
|
|
413
|
+
"credits_used": 12650,
|
|
414
|
+
"credits_used_percent": 12.7,
|
|
415
|
+
"limits": { "requests_per_second": 10, "requests_per_hour": 0, "requests_per_day": 0 },
|
|
416
|
+
"subscription": {
|
|
417
|
+
"purchased_at": "2026-11-01T09:00:00.000Z",
|
|
418
|
+
"expires_at": "2026-12-01T09:00:00.000Z",
|
|
419
|
+
"days_remaining": 7
|
|
420
|
+
}
|
|
421
|
+
}
|
|
422
|
+
```
|
|
423
|
+
|
|
424
|
+
A limit of `0` means unlimited. The answer is cached for up to 10 minutes.
|
|
425
|
+
|
|
426
|
+
### `api_keys_statistics()` — free
|
|
427
|
+
|
|
428
|
+
```python
|
|
429
|
+
stats = api.api_keys_statistics()
|
|
430
|
+
```
|
|
431
|
+
|
|
432
|
+
```json
|
|
433
|
+
{
|
|
434
|
+
"success": true,
|
|
435
|
+
"data": [
|
|
436
|
+
{
|
|
437
|
+
"apiKeyId": "cm…",
|
|
438
|
+
"apiKeyName": "Production",
|
|
439
|
+
"apiKey": "abcd1234efgh5678ijkl...",
|
|
440
|
+
"createdAt": "2026-09-01T10:00:00.000Z",
|
|
441
|
+
"statistics": {
|
|
442
|
+
"timePeriod": { "hourly": 42, "daily": 910, "weekly": 6120, "monthly": 25400, "total": 181300 },
|
|
443
|
+
"requests": { "success": 178900, "failed": 2400, "successRate": 98.7 },
|
|
444
|
+
"platforms": {
|
|
445
|
+
"YouTube": { "total": 90500, "success": 89600, "failed": 900, "hourly": 20, "daily": 450, "weekly": 3000, "monthly": 12600, "successRate": 99.0 },
|
|
446
|
+
"Instagram": { "total": 60100, "success": 59200, "failed": 900, "hourly": 15, "daily": 300, "weekly": 2100, "monthly": 8400, "successRate": 98.5 }
|
|
447
|
+
}
|
|
448
|
+
}
|
|
449
|
+
}
|
|
450
|
+
],
|
|
451
|
+
"cached": false,
|
|
452
|
+
"computedAt": "2026-11-24T05:00:00.000Z"
|
|
453
|
+
}
|
|
454
|
+
```
|
|
455
|
+
|
|
456
|
+
Statistics are cached for up to an hour. The two account samples above use illustrative numbers.
|
|
457
|
+
|
|
458
|
+
### `nsfw_scan()`
|
|
459
|
+
|
|
460
|
+
```python
|
|
461
|
+
verdict = api.nsfw_scan("https://example.com/image.jpg")
|
|
462
|
+
```
|
|
463
|
+
|
|
464
|
+
Returns the scanner's verdict for the image or video as JSON; the live sample is in the [API docs](https://saverapi.net/docs).
|
|
465
|
+
|
|
466
|
+
### Errors
|
|
467
|
+
|
|
468
|
+
A failed call raises an exception (see [Errors and retries](#errors-and-retries)); the API's JSON body is kept on it:
|
|
469
|
+
|
|
470
|
+
```python
|
|
471
|
+
try:
|
|
472
|
+
api.download("https://www.instagram.com/p/private/")
|
|
473
|
+
except SaverAPIError as exc:
|
|
474
|
+
print(exc.status_code) # e.g. 400
|
|
475
|
+
print(exc.message) # "…"
|
|
476
|
+
print(exc.payload) # {"message": "…"}
|
|
477
|
+
```
|
|
478
|
+
|
|
146
479
|
## Async (aiogram, FastAPI, asyncio)
|
|
147
480
|
|
|
148
481
|
```python
|
|
@@ -279,6 +612,9 @@ Yes: `pip install "saverapi-client[async]"` and use `AsyncSaverAPI` — same met
|
|
|
279
612
|
|
|
280
613
|
## Changelog
|
|
281
614
|
|
|
615
|
+
**2.0.1**
|
|
616
|
+
- Documentation: new **Response reference** — a real JSON sample and key-field table for every method. No code changes.
|
|
617
|
+
|
|
282
618
|
**2.0.0**
|
|
283
619
|
- YouTube: `api.youtube()` now documents the new `2160` (4K) and `1440` (2K) formats; the full list is exported as `YOUTUBE_FORMATS`.
|
|
284
620
|
- 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`.
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
__version__ = "2.0.1"
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.4
|
|
2
2
|
Name: saverapi-client
|
|
3
|
-
Version: 2.0.
|
|
3
|
+
Version: 2.0.1
|
|
4
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
5
|
Author-email: "SaverAPI.NET" <saverapinet@gmail.com>
|
|
6
6
|
License: MIT
|
|
@@ -73,9 +73,10 @@ Get a free API key at **[saverapi.net](https://saverapi.net/auth/register)** —
|
|
|
73
73
|
- **YouTube from 144p to 4K** — `2160`, `1440`, `1080`, `720`… or `mp3` audio, with no yt-dlp, ffmpeg, proxies or cookies to maintain.
|
|
74
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
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).
|
|
76
77
|
- **Production ready** — automatic retries, typed exceptions, type hints, Python 3.8–3.13.
|
|
77
78
|
|
|
78
|
-
**Contents:** [Quick start](#quick-start) · [Supported platforms](#supported-platforms) · [Examples](#examples) · [Async](#async-aiogram-fastapi-asyncio) · [Command line](#command-line) · [Errors and retries](#errors-and-retries) · [FAQ](#faq) · [Changelog](#changelog)
|
|
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)
|
|
79
80
|
|
|
80
81
|
---
|
|
81
82
|
|
|
@@ -114,7 +115,7 @@ One call, one parameter: the **All-in-One downloader** recognises the platform f
|
|
|
114
115
|
| Account balance (free) | `api.info_balance()` | `/infobalans` |
|
|
115
116
|
| Key statistics (free) | `api.api_keys_statistics()` | `/api-keys/all-statistics` |
|
|
116
117
|
|
|
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"})`.
|
|
118
119
|
|
|
119
120
|
## Examples
|
|
120
121
|
|
|
@@ -188,6 +189,338 @@ top = api.shazam_top("united-states")
|
|
|
188
189
|
print(api.info_balance())
|
|
189
190
|
```
|
|
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
|
+
|
|
191
524
|
## Async (aiogram, FastAPI, asyncio)
|
|
192
525
|
|
|
193
526
|
```python
|
|
@@ -324,6 +657,9 @@ Yes: `pip install "saverapi-client[async]"` and use `AsyncSaverAPI` — same met
|
|
|
324
657
|
|
|
325
658
|
## Changelog
|
|
326
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
|
+
|
|
327
663
|
**2.0.0**
|
|
328
664
|
- YouTube: `api.youtube()` now documents the new `2160` (4K) and `1440` (2K) formats; the full list is exported as `YOUTUBE_FORMATS`.
|
|
329
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`.
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
__version__ = "2.0.0"
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
{saverapi_client-2.0.0 → saverapi_client-2.0.1}/saverapi_client.egg-info/dependency_links.txt
RENAMED
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|