saverapi-client 1.1.0__tar.gz → 2.0.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.
Files changed (20) hide show
  1. {saverapi_client-1.1.0 → saverapi_client-2.0.0}/PKG-INFO +87 -13
  2. {saverapi_client-1.1.0 → saverapi_client-2.0.0}/README.md +83 -10
  3. {saverapi_client-1.1.0 → saverapi_client-2.0.0}/pyproject.toml +5 -4
  4. {saverapi_client-1.1.0 → saverapi_client-2.0.0}/saverapi/__init__.py +6 -4
  5. saverapi_client-2.0.0/saverapi/_version.py +1 -0
  6. {saverapi_client-1.1.0 → saverapi_client-2.0.0}/saverapi/async_client.py +15 -11
  7. {saverapi_client-1.1.0 → saverapi_client-2.0.0}/saverapi/cli.py +7 -4
  8. {saverapi_client-1.1.0 → saverapi_client-2.0.0}/saverapi/client.py +45 -20
  9. {saverapi_client-1.1.0 → saverapi_client-2.0.0}/saverapi_client.egg-info/PKG-INFO +87 -13
  10. {saverapi_client-1.1.0 → saverapi_client-2.0.0}/tests/test_client.py +54 -8
  11. saverapi_client-1.1.0/saverapi/_version.py +0 -1
  12. {saverapi_client-1.1.0 → saverapi_client-2.0.0}/LICENSE +0 -0
  13. {saverapi_client-1.1.0 → saverapi_client-2.0.0}/saverapi/exceptions.py +0 -0
  14. {saverapi_client-1.1.0 → saverapi_client-2.0.0}/saverapi/py.typed +0 -0
  15. {saverapi_client-1.1.0 → saverapi_client-2.0.0}/saverapi_client.egg-info/SOURCES.txt +0 -0
  16. {saverapi_client-1.1.0 → saverapi_client-2.0.0}/saverapi_client.egg-info/dependency_links.txt +0 -0
  17. {saverapi_client-1.1.0 → saverapi_client-2.0.0}/saverapi_client.egg-info/entry_points.txt +0 -0
  18. {saverapi_client-1.1.0 → saverapi_client-2.0.0}/saverapi_client.egg-info/requires.txt +0 -0
  19. {saverapi_client-1.1.0 → saverapi_client-2.0.0}/saverapi_client.egg-info/top_level.txt +0 -0
  20. {saverapi_client-1.1.0 → saverapi_client-2.0.0}/setup.cfg +0 -0
@@ -1,7 +1,7 @@
1
1
  Metadata-Version: 2.4
2
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.
3
+ Version: 2.0.0
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
7
7
  Project-URL: Homepage, https://saverapi.net
@@ -10,11 +10,12 @@ Project-URL: API catalog, https://saverapi.net/all-in-one-downloader-api
10
10
  Project-URL: YouTube Downloader API, https://saverapi.net/youtube-downloader-api
11
11
  Project-URL: Instagram Downloader API, https://saverapi.net/instagram-downloader-api
12
12
  Project-URL: TikTok Downloader API, https://saverapi.net/tiktok-downloader-api
13
+ Project-URL: Shazam API, https://saverapi.net/shazam-api
13
14
  Project-URL: Tutorials, https://saverapi.net/blog
14
15
  Project-URL: Pricing, https://saverapi.net/pricing
15
16
  Project-URL: Changelog, https://saverapi.net/whats-new
16
17
  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
+ 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
18
19
  Classifier: Development Status :: 5 - Production/Stable
19
20
  Classifier: Intended Audience :: Developers
20
21
  Classifier: License :: OSI Approved :: MIT License
@@ -46,14 +47,16 @@ Dynamic: license-file
46
47
 
47
48
  # SaverAPI Python SDK
48
49
 
49
- ### Social media downloader API for Python — Instagram, TikTok, YouTube, Facebook, X and more
50
+ ### Social media video downloader API for Python — YouTube (up to 4K), Instagram, TikTok, Facebook, X and more
50
51
 
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
+ 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.
52
53
 
53
54
  [![PyPI](https://img.shields.io/pypi/v/saverapi-client.svg?color=6f42c1&label=pypi&logo=pypi&logoColor=white)](https://pypi.org/project/saverapi-client/)
54
55
  [![Python](https://img.shields.io/pypi/pyversions/saverapi-client.svg?color=3776ab&logo=python&logoColor=white)](https://pypi.org/project/saverapi-client/)
55
56
  [![License](https://img.shields.io/badge/license-MIT-success.svg)](#license)
57
+ [![Downloads](https://img.shields.io/pypi/dm/saverapi-client.svg?color=0ea5e9&label=downloads)](https://pypi.org/project/saverapi-client/)
56
58
  [![Docs](https://img.shields.io/badge/docs-saverapi.net-4f46e5)](https://saverapi.net/docs)
59
+ [![Telegram](https://img.shields.io/badge/telegram-@SaverAPI-26a5e4?logo=telegram&logoColor=white)](https://t.me/SaverAPI)
57
60
 
58
61
  </div>
59
62
 
@@ -64,6 +67,16 @@ pip install -U "saverapi-client[async]" # + AsyncSaverAPI (httpx)
64
67
 
65
68
  Get a free API key at **[saverapi.net](https://saverapi.net/auth/register)** — no card needed.
66
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
+ - **Production ready** — automatic retries, typed exceptions, type hints, Python 3.8–3.13.
77
+
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
+
67
80
  ---
68
81
 
69
82
  ## Quick start
@@ -90,15 +103,13 @@ One call, one parameter: the **All-in-One downloader** recognises the platform f
90
103
  | Facebook | `api.download(url)` | [`/all-in-one-downloader-api`](https://saverapi.net/facebook-video-api) |
91
104
  | Twitter / X | `api.download(url)` | [`/all-in-one-downloader-api`](https://saverapi.net/twitter-video-api) |
92
105
  | 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` |
106
+ | YouTube video (144p–4K) / MP3 | `api.youtube(url, format)` | [`/youtube-api`](https://saverapi.net/youtube-downloader-api) |
107
+ | YouTube as a Telegram `file_id` | `api.youtube_telegram(url, format, bot_username)` | `/youtube-telegram-base` |
95
108
  | 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
109
  | Instagram profile | `api.instagram_profile(username)` | `/instagram-profile` |
98
110
  | Shazam song recognition | `api.shazam_recognize(url)` | [`/shazam-recognize`](https://saverapi.net/shazam-api) |
99
111
  | Shazam top charts | `api.shazam_top(country)` | `/shazam-music-top` |
100
112
  | Music search | `api.music_search(query, limit)` | `/music-search` |
101
- | PhotoLab effects | `api.photolab(effect_id, photo_url)` | `/photolab-api` |
102
113
  | NSFW scanner | `api.nsfw_scan(url)` | `/nsfw-scanner-api` |
103
114
  | Account balance (free) | `api.info_balance()` | `/infobalans` |
104
115
  | Key statistics (free) | `api.api_keys_statistics()` | `/api-keys/all-statistics` |
@@ -107,17 +118,42 @@ Full parameter reference and response samples: **[saverapi.net/docs](https://sav
107
118
 
108
119
  ## Examples
109
120
 
110
- ### Download a YouTube video or MP3
121
+ ### Download a YouTube video (up to 4K) or MP3 in Python
111
122
 
112
123
  ```python
113
- video = api.youtube("https://youtu.be/OORSiK8ScTI", format="720") # 1080|720|480|360|240|144|mp3
124
+ video = api.youtube("https://youtu.be/OORSiK8ScTI", format="720")
114
125
  api.save_file(video["url"], "video.mp4")
115
126
 
127
+ audio = api.youtube("https://youtu.be/OORSiK8ScTI", format="mp3")
128
+ uhd = api.youtube("https://youtu.be/OORSiK8ScTI", format="2160") # 4K, when the video has it
129
+
116
130
  info = api.youtube_info("https://youtu.be/OORSiK8ScTI")
117
131
  print(info["title"], info["duration"])
118
132
  ```
119
133
 
120
- ### Download TikTok, Facebook or X videos
134
+ `format` is one of `2160`, `1440`, `1080`, `720`, `480`, `360`, `240`, `144` or `mp3` (also available as `saverapi.YOUTUBE_FORMATS`).
135
+
136
+ ### YouTube straight into a Telegram bot (`file_id`)
137
+
138
+ 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.
139
+
140
+ ```python
141
+ import time
142
+
143
+ res = api.youtube_telegram("https://youtu.be/OORSiK8ScTI", format="720", bot_username="@MyBot")
144
+ while res.get("status") == "processing": # a new video is still being prepared
145
+ time.sleep(res.get("retry_after", 5))
146
+ res = api.youtube_telegram("https://youtu.be/OORSiK8ScTI", format="720", bot_username="@MyBot")
147
+
148
+ if res["media_type"] == "video":
149
+ bot.send_video(chat_id, res["file_id"]) # your Telegram library's sendVideo
150
+ else:
151
+ bot.send_audio(chat_id, res["file_id"]) # format="mp3" → sendAudio
152
+ ```
153
+
154
+ 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.
155
+
156
+ ### Download TikTok, Instagram, Facebook or X videos
121
157
 
122
158
  ```python
123
159
  for link in [
@@ -129,7 +165,7 @@ for link in [
129
165
  print(media["hosting"], media["download_url"])
130
166
  ```
131
167
 
132
- ### Instagram profile
168
+ ### Instagram profile data
133
169
 
134
170
  ```python
135
171
  profile = api.instagram_profile("cristiano")
@@ -203,6 +239,7 @@ Step-by-step guide: **[Build a Telegram video downloader bot](https://saverapi.n
203
239
  export SAVERAPI_KEY=your_key
204
240
  saverapi download https://www.instagram.com/reel/DPOi9V-CAqH/
205
241
  saverapi youtube https://youtu.be/OORSiK8ScTI --format mp3
242
+ saverapi youtube-telegram https://youtu.be/OORSiK8ScTI --bot @MyBot
206
243
  saverapi youtube-info https://youtu.be/OORSiK8ScTI
207
244
  saverapi instagram cristiano
208
245
  saverapi shazam https://example.com/clip.mp3
@@ -242,6 +279,29 @@ Options: `SaverAPI(api_key=None, timeout=60, base_url=None, session=None, max_re
242
279
  - Keep the API key on your server; mobile and web apps should call your backend.
243
280
  - Respect each platform's terms of service and creators' rights.
244
281
 
282
+ ## FAQ
283
+
284
+ **How do I download a YouTube video in Python?**
285
+ 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.
286
+
287
+ **Can I download YouTube in 4K or 1440p?**
288
+ Yes: `format="2160"` (4K) and `format="1440"` (2K) are supported alongside 1080, 720, 480, 360, 240 and 144, when the video has that quality.
289
+
290
+ **How do I convert YouTube to MP3?**
291
+ `api.youtube(url, format="mp3")` returns a link to the audio file.
292
+
293
+ **How do I download Instagram Reels or TikTok videos in Python?**
294
+ `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.
295
+
296
+ **How do I send a YouTube video from a Telegram bot without uploading it?**
297
+ 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.
298
+
299
+ **Is there a free plan?**
300
+ 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.
301
+
302
+ **Does it work with asyncio?**
303
+ Yes: `pip install "saverapi-client[async]"` and use `AsyncSaverAPI` — same methods, awaited.
304
+
245
305
  ## Links
246
306
 
247
307
  - Website and free API key: https://saverapi.net
@@ -249,13 +309,27 @@ Options: `SaverAPI(api_key=None, timeout=60, base_url=None, session=None, max_re
249
309
  - YouTube Downloader API: https://saverapi.net/youtube-downloader-api
250
310
  - Instagram Downloader API: https://saverapi.net/instagram-downloader-api
251
311
  - TikTok Downloader API: https://saverapi.net/tiktok-downloader-api
312
+ - Facebook Video API: https://saverapi.net/facebook-video-api
313
+ - Twitter / X Video API: https://saverapi.net/twitter-video-api
314
+ - Shazam Song Recognition API: https://saverapi.net/shazam-api
315
+ - Social Media Downloader API: https://saverapi.net/social-media-downloader-api
252
316
  - All-in-One Downloader API: https://saverapi.net/all-in-one-downloader-api
253
317
  - Tutorials: https://saverapi.net/blog
318
+ - [YouTube downloader API in Python](https://saverapi.net/blog/youtube-downloader-api-python)
319
+ - [Build a Telegram YouTube downloader bot](https://saverapi.net/blog/build-telegram-youtube-downloader-bot)
320
+ - [Download Instagram Reels with Python](https://saverapi.net/blog/download-instagram-reels-python)
321
+ - [A yt-dlp API alternative](https://saverapi.net/blog/yt-dlp-api-alternative)
254
322
  - Pricing: https://saverapi.net/pricing
255
323
  - Telegram: https://t.me/SaverAPI
256
324
 
257
325
  ## Changelog
258
326
 
327
+ **2.0.0**
328
+ - YouTube: `api.youtube()` now documents the new `2160` (4K) and `1440` (2K) formats; the full list is exported as `YOUTUBE_FORMATS`.
329
+ - 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`.
330
+ - **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.
331
+ - `format` accepts an `int` as well as a `str` in type hints (`format=720`).
332
+
259
333
  **1.1.0**
260
334
  - New methods covering the whole catalog: `youtube_telegram`, `youtube_info_basic`, `youtube_subtitles`, `instagram_profile`, `photolab`, and `request()` for any endpoint.
261
335
  - `AsyncSaverAPI` for asyncio (`pip install "saverapi-client[async]"`).
@@ -2,14 +2,16 @@
2
2
 
3
3
  # SaverAPI Python SDK
4
4
 
5
- ### Social media downloader API for Python — Instagram, TikTok, YouTube, Facebook, X and more
5
+ ### Social media video downloader API for Python — YouTube (up to 4K), Instagram, TikTok, Facebook, X and more
6
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.
7
+ 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.
8
8
 
9
9
  [![PyPI](https://img.shields.io/pypi/v/saverapi-client.svg?color=6f42c1&label=pypi&logo=pypi&logoColor=white)](https://pypi.org/project/saverapi-client/)
10
10
  [![Python](https://img.shields.io/pypi/pyversions/saverapi-client.svg?color=3776ab&logo=python&logoColor=white)](https://pypi.org/project/saverapi-client/)
11
11
  [![License](https://img.shields.io/badge/license-MIT-success.svg)](#license)
12
+ [![Downloads](https://img.shields.io/pypi/dm/saverapi-client.svg?color=0ea5e9&label=downloads)](https://pypi.org/project/saverapi-client/)
12
13
  [![Docs](https://img.shields.io/badge/docs-saverapi.net-4f46e5)](https://saverapi.net/docs)
14
+ [![Telegram](https://img.shields.io/badge/telegram-@SaverAPI-26a5e4?logo=telegram&logoColor=white)](https://t.me/SaverAPI)
13
15
 
14
16
  </div>
15
17
 
@@ -20,6 +22,16 @@ pip install -U "saverapi-client[async]" # + AsyncSaverAPI (httpx)
20
22
 
21
23
  Get a free API key at **[saverapi.net](https://saverapi.net/auth/register)** — no card needed.
22
24
 
25
+ **Why SaverAPI**
26
+
27
+ - **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.
28
+ - **YouTube from 144p to 4K** — `2160`, `1440`, `1080`, `720`… or `mp3` audio, with no yt-dlp, ffmpeg, proxies or cookies to maintain.
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
+ - **Sync, async and CLI** — `SaverAPI` (requests), `AsyncSaverAPI` (httpx, for aiogram / FastAPI) and a `saverapi` terminal command.
31
+ - **Production ready** — automatic retries, typed exceptions, type hints, Python 3.8–3.13.
32
+
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
+
23
35
  ---
24
36
 
25
37
  ## Quick start
@@ -46,15 +58,13 @@ One call, one parameter: the **All-in-One downloader** recognises the platform f
46
58
  | Facebook | `api.download(url)` | [`/all-in-one-downloader-api`](https://saverapi.net/facebook-video-api) |
47
59
  | Twitter / X | `api.download(url)` | [`/all-in-one-downloader-api`](https://saverapi.net/twitter-video-api) |
48
60
  | 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` |
61
+ | YouTube video (144p–4K) / MP3 | `api.youtube(url, format)` | [`/youtube-api`](https://saverapi.net/youtube-downloader-api) |
62
+ | YouTube as a Telegram `file_id` | `api.youtube_telegram(url, format, bot_username)` | `/youtube-telegram-base` |
51
63
  | 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
64
  | Instagram profile | `api.instagram_profile(username)` | `/instagram-profile` |
54
65
  | Shazam song recognition | `api.shazam_recognize(url)` | [`/shazam-recognize`](https://saverapi.net/shazam-api) |
55
66
  | Shazam top charts | `api.shazam_top(country)` | `/shazam-music-top` |
56
67
  | Music search | `api.music_search(query, limit)` | `/music-search` |
57
- | PhotoLab effects | `api.photolab(effect_id, photo_url)` | `/photolab-api` |
58
68
  | NSFW scanner | `api.nsfw_scan(url)` | `/nsfw-scanner-api` |
59
69
  | Account balance (free) | `api.info_balance()` | `/infobalans` |
60
70
  | Key statistics (free) | `api.api_keys_statistics()` | `/api-keys/all-statistics` |
@@ -63,17 +73,42 @@ Full parameter reference and response samples: **[saverapi.net/docs](https://sav
63
73
 
64
74
  ## Examples
65
75
 
66
- ### Download a YouTube video or MP3
76
+ ### Download a YouTube video (up to 4K) or MP3 in Python
67
77
 
68
78
  ```python
69
- video = api.youtube("https://youtu.be/OORSiK8ScTI", format="720") # 1080|720|480|360|240|144|mp3
79
+ video = api.youtube("https://youtu.be/OORSiK8ScTI", format="720")
70
80
  api.save_file(video["url"], "video.mp4")
71
81
 
82
+ audio = api.youtube("https://youtu.be/OORSiK8ScTI", format="mp3")
83
+ uhd = api.youtube("https://youtu.be/OORSiK8ScTI", format="2160") # 4K, when the video has it
84
+
72
85
  info = api.youtube_info("https://youtu.be/OORSiK8ScTI")
73
86
  print(info["title"], info["duration"])
74
87
  ```
75
88
 
76
- ### Download TikTok, Facebook or X videos
89
+ `format` is one of `2160`, `1440`, `1080`, `720`, `480`, `360`, `240`, `144` or `mp3` (also available as `saverapi.YOUTUBE_FORMATS`).
90
+
91
+ ### YouTube straight into a Telegram bot (`file_id`)
92
+
93
+ 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.
94
+
95
+ ```python
96
+ import time
97
+
98
+ res = api.youtube_telegram("https://youtu.be/OORSiK8ScTI", format="720", bot_username="@MyBot")
99
+ while res.get("status") == "processing": # a new video is still being prepared
100
+ time.sleep(res.get("retry_after", 5))
101
+ res = api.youtube_telegram("https://youtu.be/OORSiK8ScTI", format="720", bot_username="@MyBot")
102
+
103
+ if res["media_type"] == "video":
104
+ bot.send_video(chat_id, res["file_id"]) # your Telegram library's sendVideo
105
+ else:
106
+ bot.send_audio(chat_id, res["file_id"]) # format="mp3" → sendAudio
107
+ ```
108
+
109
+ 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.
110
+
111
+ ### Download TikTok, Instagram, Facebook or X videos
77
112
 
78
113
  ```python
79
114
  for link in [
@@ -85,7 +120,7 @@ for link in [
85
120
  print(media["hosting"], media["download_url"])
86
121
  ```
87
122
 
88
- ### Instagram profile
123
+ ### Instagram profile data
89
124
 
90
125
  ```python
91
126
  profile = api.instagram_profile("cristiano")
@@ -159,6 +194,7 @@ Step-by-step guide: **[Build a Telegram video downloader bot](https://saverapi.n
159
194
  export SAVERAPI_KEY=your_key
160
195
  saverapi download https://www.instagram.com/reel/DPOi9V-CAqH/
161
196
  saverapi youtube https://youtu.be/OORSiK8ScTI --format mp3
197
+ saverapi youtube-telegram https://youtu.be/OORSiK8ScTI --bot @MyBot
162
198
  saverapi youtube-info https://youtu.be/OORSiK8ScTI
163
199
  saverapi instagram cristiano
164
200
  saverapi shazam https://example.com/clip.mp3
@@ -198,6 +234,29 @@ Options: `SaverAPI(api_key=None, timeout=60, base_url=None, session=None, max_re
198
234
  - Keep the API key on your server; mobile and web apps should call your backend.
199
235
  - Respect each platform's terms of service and creators' rights.
200
236
 
237
+ ## FAQ
238
+
239
+ **How do I download a YouTube video in Python?**
240
+ 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.
241
+
242
+ **Can I download YouTube in 4K or 1440p?**
243
+ Yes: `format="2160"` (4K) and `format="1440"` (2K) are supported alongside 1080, 720, 480, 360, 240 and 144, when the video has that quality.
244
+
245
+ **How do I convert YouTube to MP3?**
246
+ `api.youtube(url, format="mp3")` returns a link to the audio file.
247
+
248
+ **How do I download Instagram Reels or TikTok videos in Python?**
249
+ `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.
250
+
251
+ **How do I send a YouTube video from a Telegram bot without uploading it?**
252
+ 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.
253
+
254
+ **Is there a free plan?**
255
+ 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.
256
+
257
+ **Does it work with asyncio?**
258
+ Yes: `pip install "saverapi-client[async]"` and use `AsyncSaverAPI` — same methods, awaited.
259
+
201
260
  ## Links
202
261
 
203
262
  - Website and free API key: https://saverapi.net
@@ -205,13 +264,27 @@ Options: `SaverAPI(api_key=None, timeout=60, base_url=None, session=None, max_re
205
264
  - YouTube Downloader API: https://saverapi.net/youtube-downloader-api
206
265
  - Instagram Downloader API: https://saverapi.net/instagram-downloader-api
207
266
  - TikTok Downloader API: https://saverapi.net/tiktok-downloader-api
267
+ - Facebook Video API: https://saverapi.net/facebook-video-api
268
+ - Twitter / X Video API: https://saverapi.net/twitter-video-api
269
+ - Shazam Song Recognition API: https://saverapi.net/shazam-api
270
+ - Social Media Downloader API: https://saverapi.net/social-media-downloader-api
208
271
  - All-in-One Downloader API: https://saverapi.net/all-in-one-downloader-api
209
272
  - Tutorials: https://saverapi.net/blog
273
+ - [YouTube downloader API in Python](https://saverapi.net/blog/youtube-downloader-api-python)
274
+ - [Build a Telegram YouTube downloader bot](https://saverapi.net/blog/build-telegram-youtube-downloader-bot)
275
+ - [Download Instagram Reels with Python](https://saverapi.net/blog/download-instagram-reels-python)
276
+ - [A yt-dlp API alternative](https://saverapi.net/blog/yt-dlp-api-alternative)
210
277
  - Pricing: https://saverapi.net/pricing
211
278
  - Telegram: https://t.me/SaverAPI
212
279
 
213
280
  ## Changelog
214
281
 
282
+ **2.0.0**
283
+ - YouTube: `api.youtube()` now documents the new `2160` (4K) and `1440` (2K) formats; the full list is exported as `YOUTUBE_FORMATS`.
284
+ - 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`.
285
+ - **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.
286
+ - `format` accepts an `int` as well as a `str` in type hints (`format=720`).
287
+
215
288
  **1.1.0**
216
289
  - New methods covering the whole catalog: `youtube_telegram`, `youtube_info_basic`, `youtube_subtitles`, `instagram_profile`, `photolab`, and `request()` for any endpoint.
217
290
  - `AsyncSaverAPI` for asyncio (`pip install "saverapi-client[async]"`).
@@ -5,7 +5,7 @@ build-backend = "setuptools.build_meta"
5
5
  [project]
6
6
  name = "saverapi-client"
7
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."
8
+ description = "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."
9
9
  readme = "README.md"
10
10
  requires-python = ">=3.8"
11
11
  license = { text = "MIT" }
@@ -15,12 +15,12 @@ keywords = [
15
15
  "saverapi", "social media downloader api", "video downloader api", "all in one downloader",
16
16
  "instagram downloader", "instagram reels downloader", "instagram api", "instagram profile api",
17
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",
18
+ "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",
19
19
  "facebook video downloader", "twitter video downloader", "x video downloader",
20
20
  "pinterest downloader", "threads downloader", "snapchat downloader", "vimeo downloader", "soundcloud downloader",
21
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",
22
+ "nsfw scanner", "nsfw detection api",
23
+ "telegram bot downloader", "telegram bot youtube", "aiogram", "python-telegram-bot", "instagram reels api", "social media api", "async api client", "python sdk", "rest api client",
24
24
  ]
25
25
  classifiers = [
26
26
  "Development Status :: 5 - Production/Stable",
@@ -57,6 +57,7 @@ Documentation = "https://saverapi.net/docs"
57
57
  "YouTube Downloader API" = "https://saverapi.net/youtube-downloader-api"
58
58
  "Instagram Downloader API" = "https://saverapi.net/instagram-downloader-api"
59
59
  "TikTok Downloader API" = "https://saverapi.net/tiktok-downloader-api"
60
+ "Shazam API" = "https://saverapi.net/shazam-api"
60
61
  Tutorials = "https://saverapi.net/blog"
61
62
  Pricing = "https://saverapi.net/pricing"
62
63
  Changelog = "https://saverapi.net/whats-new"
@@ -2,9 +2,9 @@
2
2
  saverapi — official Python SDK for SaverAPI.NET (https://saverapi.net).
3
3
 
4
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.
5
+ Facebook, Twitter (X), Pinterest, Threads, Vimeo and more, plus YouTube up
6
+ to 4K, Telegram-ready YouTube files, YouTube metadata, Instagram profiles,
7
+ Shazam recognition, music search and an NSFW scanner.
8
8
 
9
9
  from saverapi import SaverAPI
10
10
  api = SaverAPI(api_key="YOUR_API_KEY") # or set SAVERAPI_KEY
@@ -13,7 +13,7 @@ profiles and an NSFW scanner.
13
13
 
14
14
  from ._version import __version__
15
15
  from .async_client import AsyncSaverAPI
16
- from .client import SaverAPI
16
+ from .client import YOUTUBE_FORMATS, YOUTUBE_TELEGRAM_FORMATS, SaverAPI
17
17
  from .exceptions import (
18
18
  AuthenticationError,
19
19
  InsufficientCreditsError,
@@ -34,5 +34,7 @@ __all__ = [
34
34
  "NotFoundError",
35
35
  "ServerError",
36
36
  "NetworkError",
37
+ "YOUTUBE_FORMATS",
38
+ "YOUTUBE_TELEGRAM_FORMATS",
37
39
  "__version__",
38
40
  ]
@@ -0,0 +1 @@
1
+ __version__ = "2.0.0"
@@ -18,7 +18,7 @@ Requires the ``async`` extra::
18
18
  from __future__ import annotations
19
19
 
20
20
  import asyncio
21
- from typing import Any, Dict, Optional
21
+ from typing import Any, Dict, Optional, Union
22
22
 
23
23
  from .client import DEFAULT_BASE_URL, RETRY_STATUSES, USER_AGENT, _backoff, _retry_after, error_message, resolve_api_key
24
24
  from .exceptions import NetworkError, error_for
@@ -98,12 +98,22 @@ class AsyncSaverAPI:
98
98
  """All-in-One downloader (Instagram, TikTok, Facebook, X, Pinterest, Threads, Vimeo…)."""
99
99
  return await self.request("/all-in-one-downloader-api", {"url": url})
100
100
 
101
- async def youtube(self, url: str, format: str = "720") -> Dict[str, Any]:
102
- """YouTube video or audio; ``format`` 1080/720/480/360/240/144/mp3."""
101
+ async def youtube(self, url: str, format: Union[str, int] = "720") -> Dict[str, Any]:
102
+ """YouTube video or audio; ``format`` 2160/1440/1080/720/480/360/240/144/mp3."""
103
103
  return await self.request("/youtube-api", {"url": url, "farmat": str(format)})
104
104
 
105
- async def youtube_telegram(self, url: str, format: str = "720") -> Dict[str, Any]:
106
- return await self.request("/youtube-telegram-base", {"url": url, "farmat": str(format)})
105
+ async def youtube_telegram(
106
+ self,
107
+ url: str,
108
+ format: Union[str, int] = "720",
109
+ bot_username: Optional[str] = None,
110
+ ) -> Dict[str, Any]:
111
+ """Telegram-ready YouTube file; with ``bot_username`` the response has a ``file_id``
112
+ for that bot. See :meth:`saverapi.SaverAPI.youtube_telegram`."""
113
+ return await self.request(
114
+ "/youtube-telegram-base",
115
+ {"url": url, "farmat": str(format), "bot_username": bot_username or None},
116
+ )
107
117
 
108
118
  async def youtube_info(self, url: str) -> Dict[str, Any]:
109
119
  return await self.request("/youtube-info-v2", {"url": url})
@@ -111,9 +121,6 @@ class AsyncSaverAPI:
111
121
  async def youtube_info_basic(self, url: str) -> Dict[str, Any]:
112
122
  return await self.request("/youtube-info", {"url": url})
113
123
 
114
- async def youtube_subtitles(self, url: str) -> Dict[str, Any]:
115
- return await self.request("/youtube-subtitles", {"url": url})
116
-
117
124
  async def instagram_profile(self, username: str) -> Dict[str, Any]:
118
125
  return await self.request("/instagram-profile", {"Userinfo": username.lstrip("@")})
119
126
 
@@ -126,9 +133,6 @@ class AsyncSaverAPI:
126
133
  async def shazam_top(self, country: str = "us") -> Dict[str, Any]:
127
134
  return await self.request("/shazam-music-top", {"country": country})
128
135
 
129
- async def photolab(self, effect_id: str, photo_url: str) -> Dict[str, Any]:
130
- return await self.request("/photolab-api", {"id": str(effect_id), "photo": photo_url})
131
-
132
136
  async def nsfw_scan(self, url: str) -> Dict[str, Any]:
133
137
  return await self.request("/nsfw-scanner-api", {"url": url})
134
138
 
@@ -4,6 +4,7 @@ Command line for SaverAPI. Prints the JSON response.
4
4
  export SAVERAPI_KEY=your_key
5
5
  saverapi download https://www.instagram.com/reel/xxxx/
6
6
  saverapi youtube https://youtu.be/xxxx --format mp3
7
+ saverapi youtube-telegram https://youtu.be/xxxx --bot @MyBot
7
8
  saverapi youtube-info https://youtu.be/xxxx
8
9
  saverapi shazam https://example.com/song.mp3
9
10
  saverapi balance
@@ -17,7 +18,7 @@ import sys
17
18
  from typing import List, Optional
18
19
 
19
20
  from ._version import __version__
20
- from .client import SaverAPI
21
+ from .client import YOUTUBE_FORMATS, YOUTUBE_TELEGRAM_FORMATS, SaverAPI
21
22
  from .exceptions import SaverAPIError
22
23
 
23
24
 
@@ -34,9 +35,11 @@ def build_parser() -> argparse.ArgumentParser:
34
35
 
35
36
  url_cmd("download", "All-in-One download: Instagram, TikTok, Facebook, X, Pinterest, Threads, Vimeo…")
36
37
  yt = url_cmd("youtube", "Download a YouTube video or audio")
37
- yt.add_argument("--format", default="720", help="1080|720|480|360|240|144|mp3 (default 720)")
38
+ yt.add_argument("--format", default="720", help="|".join(YOUTUBE_FORMATS) + " (default 720)")
39
+ tg = url_cmd("youtube-telegram", "YouTube as a ready Telegram file (file_id for your bot)")
40
+ tg.add_argument("--format", default="720", help="|".join(YOUTUBE_TELEGRAM_FORMATS) + " (default 720)")
41
+ tg.add_argument("--bot", metavar="@USERNAME", help="your Telegram bot; the response then carries a file_id for it")
38
42
  url_cmd("youtube-info", "YouTube metadata")
39
- url_cmd("subtitles", "YouTube subtitles")
40
43
  url_cmd("shazam", "Recognize a song from an audio/video URL")
41
44
  url_cmd("nsfw", "Scan an image/video URL for NSFW content")
42
45
  ig = sub.add_parser("instagram", help="Public Instagram profile")
@@ -61,8 +64,8 @@ def main(argv: Optional[List[str]] = None) -> int:
61
64
  calls = {
62
65
  "download": lambda: api.download(args.url),
63
66
  "youtube": lambda: api.youtube(args.url, args.format),
67
+ "youtube-telegram": lambda: api.youtube_telegram(args.url, args.format, args.bot),
64
68
  "youtube-info": lambda: api.youtube_info(args.url),
65
- "subtitles": lambda: api.youtube_subtitles(args.url),
66
69
  "shazam": lambda: api.shazam_recognize(args.url),
67
70
  "nsfw": lambda: api.nsfw_scan(args.url),
68
71
  "instagram": lambda: api.instagram_profile(args.username),
@@ -4,9 +4,9 @@ SaverAPI Python client.
4
4
  Official SDK for https://saverapi.net — one REST API for social media
5
5
  downloads and media data: Instagram, TikTok, YouTube, Facebook, Twitter (X),
6
6
  Snapchat, Pinterest, Likee, SoundCloud, Spotify, Threads, Twitch, Weibo,
7
- Vimeo and more, plus Shazam music recognition, music search, Shazam charts,
8
- YouTube metadata and subtitles, Instagram profiles, PhotoLab effects and an
9
- NSFW scanner.
7
+ Vimeo and more, plus YouTube downloads up to 4K, Telegram-ready YouTube
8
+ files, YouTube metadata, Instagram profiles, Shazam music recognition, music
9
+ search, Shazam charts and an NSFW scanner.
10
10
  """
11
11
 
12
12
  from __future__ import annotations
@@ -14,7 +14,7 @@ from __future__ import annotations
14
14
  import os
15
15
  import random
16
16
  import time
17
- from typing import Any, Dict, Optional
17
+ from typing import Any, Dict, Optional, Tuple, Union
18
18
 
19
19
  import requests
20
20
 
@@ -27,6 +27,12 @@ ENV_API_KEY = "SAVERAPI_KEY"
27
27
  #: Failed 5xx calls are not charged, so retrying them costs nothing.
28
28
  RETRY_STATUSES = frozenset({429, 500, 502, 503, 504})
29
29
 
30
+ #: ``format`` values accepted by :meth:`SaverAPI.youtube` (video height, or ``"mp3"`` for audio).
31
+ YOUTUBE_FORMATS: Tuple[str, ...] = ("2160", "1440", "1080", "720", "480", "360", "240", "144", "mp3")
32
+
33
+ #: ``format`` values accepted by :meth:`SaverAPI.youtube_telegram`.
34
+ YOUTUBE_TELEGRAM_FORMATS: Tuple[str, ...] = ("1080", "720", "480", "360", "240", "144", "mp3")
35
+
30
36
  from ._version import __version__ as _version
31
37
 
32
38
  USER_AGENT = f"saverapi-client/{_version} (+https://saverapi.net)"
@@ -167,18 +173,38 @@ class SaverAPI:
167
173
  # ------------------------------------------------------------------ #
168
174
  # YouTube
169
175
  # ------------------------------------------------------------------ #
170
- def youtube(self, url: str, format: str = "720") -> Dict[str, Any]:
176
+ def youtube(self, url: str, format: Union[str, int] = "720") -> Dict[str, Any]:
171
177
  """Download a YouTube video or its audio.
172
178
 
173
- ``format``: ``"1080"``, ``"720"``, ``"480"``, ``"360"``, ``"240"``,
174
- ``"144"`` or ``"mp3"``.
179
+ ``format``: ``"2160"`` (4K), ``"1440"`` (2K), ``"1080"``, ``"720"``,
180
+ ``"480"``, ``"360"``, ``"240"``, ``"144"`` or ``"mp3"`` — see
181
+ :data:`YOUTUBE_FORMATS`. The response's ``url`` points at the file.
175
182
  """
176
183
  # The service's parameter is spelled "farmat".
177
184
  return self.request("/youtube-api", {"url": url, "farmat": str(format)})
178
185
 
179
- def youtube_telegram(self, url: str, format: str = "720") -> Dict[str, Any]:
180
- """YouTube download prepared for Telegram bots (same formats as :meth:`youtube`)."""
181
- return self.request("/youtube-telegram-base", {"url": url, "farmat": str(format)})
186
+ def youtube_telegram(
187
+ self,
188
+ url: str,
189
+ format: Union[str, int] = "720",
190
+ bot_username: Optional[str] = None,
191
+ ) -> Dict[str, Any]:
192
+ """YouTube video or audio as a ready-to-send Telegram file.
193
+
194
+ ``format``: ``"1080"``, ``"720"``, ``"480"``, ``"360"``, ``"240"``,
195
+ ``"144"`` or ``"mp3"`` — see :data:`YOUTUBE_TELEGRAM_FORMATS`.
196
+
197
+ ``bot_username``: your Telegram bot (``"@MyBot"``). When given, the
198
+ response carries a ``file_id`` valid for that bot: pass it to
199
+ ``sendVideo`` when ``media_type`` is ``"video"`` or ``sendAudio`` when
200
+ it is ``"audio"`` — no re-upload needed, and the id can be stored and
201
+ reused. If ``status`` is ``"processing"``, call again after
202
+ ``retry_after`` seconds.
203
+ """
204
+ return self.request(
205
+ "/youtube-telegram-base",
206
+ {"url": url, "farmat": str(format), "bot_username": bot_username or None},
207
+ )
182
208
 
183
209
  def youtube_info(self, url: str) -> Dict[str, Any]:
184
210
  """Detailed YouTube metadata: title, author, duration, thumbnails, formats."""
@@ -188,10 +214,6 @@ class SaverAPI:
188
214
  """Lightweight YouTube metadata (title, author, thumbnail) — the cheapest YouTube call."""
189
215
  return self.request("/youtube-info", {"url": url})
190
216
 
191
- def youtube_subtitles(self, url: str) -> Dict[str, Any]:
192
- """Subtitles / captions of a YouTube video."""
193
- return self.request("/youtube-subtitles", {"url": url})
194
-
195
217
  # ------------------------------------------------------------------ #
196
218
  # Instagram
197
219
  # ------------------------------------------------------------------ #
@@ -215,12 +237,8 @@ class SaverAPI:
215
237
  return self.request("/shazam-music-top", {"country": country})
216
238
 
217
239
  # ------------------------------------------------------------------ #
218
- # Images and moderation
240
+ # Moderation
219
241
  # ------------------------------------------------------------------ #
220
- def photolab(self, effect_id: str, photo_url: str) -> Dict[str, Any]:
221
- """Apply a PhotoLab effect (by its id) to a photo URL."""
222
- return self.request("/photolab-api", {"id": str(effect_id), "photo": photo_url})
223
-
224
242
  def nsfw_scan(self, url: str) -> Dict[str, Any]:
225
243
  """Scan an image or video URL for NSFW content."""
226
244
  return self.request("/nsfw-scanner-api", {"url": url})
@@ -265,4 +283,11 @@ def _retry_after(value: Optional[str]) -> Optional[float]:
265
283
  return None
266
284
 
267
285
 
268
- __all__ = ["SaverAPI", "SaverAPIError", "DEFAULT_BASE_URL", "ENV_API_KEY"]
286
+ __all__ = [
287
+ "SaverAPI",
288
+ "SaverAPIError",
289
+ "DEFAULT_BASE_URL",
290
+ "ENV_API_KEY",
291
+ "YOUTUBE_FORMATS",
292
+ "YOUTUBE_TELEGRAM_FORMATS",
293
+ ]
@@ -1,7 +1,7 @@
1
1
  Metadata-Version: 2.4
2
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.
3
+ Version: 2.0.0
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
7
7
  Project-URL: Homepage, https://saverapi.net
@@ -10,11 +10,12 @@ Project-URL: API catalog, https://saverapi.net/all-in-one-downloader-api
10
10
  Project-URL: YouTube Downloader API, https://saverapi.net/youtube-downloader-api
11
11
  Project-URL: Instagram Downloader API, https://saverapi.net/instagram-downloader-api
12
12
  Project-URL: TikTok Downloader API, https://saverapi.net/tiktok-downloader-api
13
+ Project-URL: Shazam API, https://saverapi.net/shazam-api
13
14
  Project-URL: Tutorials, https://saverapi.net/blog
14
15
  Project-URL: Pricing, https://saverapi.net/pricing
15
16
  Project-URL: Changelog, https://saverapi.net/whats-new
16
17
  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
+ 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
18
19
  Classifier: Development Status :: 5 - Production/Stable
19
20
  Classifier: Intended Audience :: Developers
20
21
  Classifier: License :: OSI Approved :: MIT License
@@ -46,14 +47,16 @@ Dynamic: license-file
46
47
 
47
48
  # SaverAPI Python SDK
48
49
 
49
- ### Social media downloader API for Python — Instagram, TikTok, YouTube, Facebook, X and more
50
+ ### Social media video downloader API for Python — YouTube (up to 4K), Instagram, TikTok, Facebook, X and more
50
51
 
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
+ 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.
52
53
 
53
54
  [![PyPI](https://img.shields.io/pypi/v/saverapi-client.svg?color=6f42c1&label=pypi&logo=pypi&logoColor=white)](https://pypi.org/project/saverapi-client/)
54
55
  [![Python](https://img.shields.io/pypi/pyversions/saverapi-client.svg?color=3776ab&logo=python&logoColor=white)](https://pypi.org/project/saverapi-client/)
55
56
  [![License](https://img.shields.io/badge/license-MIT-success.svg)](#license)
57
+ [![Downloads](https://img.shields.io/pypi/dm/saverapi-client.svg?color=0ea5e9&label=downloads)](https://pypi.org/project/saverapi-client/)
56
58
  [![Docs](https://img.shields.io/badge/docs-saverapi.net-4f46e5)](https://saverapi.net/docs)
59
+ [![Telegram](https://img.shields.io/badge/telegram-@SaverAPI-26a5e4?logo=telegram&logoColor=white)](https://t.me/SaverAPI)
57
60
 
58
61
  </div>
59
62
 
@@ -64,6 +67,16 @@ pip install -U "saverapi-client[async]" # + AsyncSaverAPI (httpx)
64
67
 
65
68
  Get a free API key at **[saverapi.net](https://saverapi.net/auth/register)** — no card needed.
66
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
+ - **Production ready** — automatic retries, typed exceptions, type hints, Python 3.8–3.13.
77
+
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
+
67
80
  ---
68
81
 
69
82
  ## Quick start
@@ -90,15 +103,13 @@ One call, one parameter: the **All-in-One downloader** recognises the platform f
90
103
  | Facebook | `api.download(url)` | [`/all-in-one-downloader-api`](https://saverapi.net/facebook-video-api) |
91
104
  | Twitter / X | `api.download(url)` | [`/all-in-one-downloader-api`](https://saverapi.net/twitter-video-api) |
92
105
  | 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` |
106
+ | YouTube video (144p–4K) / MP3 | `api.youtube(url, format)` | [`/youtube-api`](https://saverapi.net/youtube-downloader-api) |
107
+ | YouTube as a Telegram `file_id` | `api.youtube_telegram(url, format, bot_username)` | `/youtube-telegram-base` |
95
108
  | 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
109
  | Instagram profile | `api.instagram_profile(username)` | `/instagram-profile` |
98
110
  | Shazam song recognition | `api.shazam_recognize(url)` | [`/shazam-recognize`](https://saverapi.net/shazam-api) |
99
111
  | Shazam top charts | `api.shazam_top(country)` | `/shazam-music-top` |
100
112
  | Music search | `api.music_search(query, limit)` | `/music-search` |
101
- | PhotoLab effects | `api.photolab(effect_id, photo_url)` | `/photolab-api` |
102
113
  | NSFW scanner | `api.nsfw_scan(url)` | `/nsfw-scanner-api` |
103
114
  | Account balance (free) | `api.info_balance()` | `/infobalans` |
104
115
  | Key statistics (free) | `api.api_keys_statistics()` | `/api-keys/all-statistics` |
@@ -107,17 +118,42 @@ Full parameter reference and response samples: **[saverapi.net/docs](https://sav
107
118
 
108
119
  ## Examples
109
120
 
110
- ### Download a YouTube video or MP3
121
+ ### Download a YouTube video (up to 4K) or MP3 in Python
111
122
 
112
123
  ```python
113
- video = api.youtube("https://youtu.be/OORSiK8ScTI", format="720") # 1080|720|480|360|240|144|mp3
124
+ video = api.youtube("https://youtu.be/OORSiK8ScTI", format="720")
114
125
  api.save_file(video["url"], "video.mp4")
115
126
 
127
+ audio = api.youtube("https://youtu.be/OORSiK8ScTI", format="mp3")
128
+ uhd = api.youtube("https://youtu.be/OORSiK8ScTI", format="2160") # 4K, when the video has it
129
+
116
130
  info = api.youtube_info("https://youtu.be/OORSiK8ScTI")
117
131
  print(info["title"], info["duration"])
118
132
  ```
119
133
 
120
- ### Download TikTok, Facebook or X videos
134
+ `format` is one of `2160`, `1440`, `1080`, `720`, `480`, `360`, `240`, `144` or `mp3` (also available as `saverapi.YOUTUBE_FORMATS`).
135
+
136
+ ### YouTube straight into a Telegram bot (`file_id`)
137
+
138
+ 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.
139
+
140
+ ```python
141
+ import time
142
+
143
+ res = api.youtube_telegram("https://youtu.be/OORSiK8ScTI", format="720", bot_username="@MyBot")
144
+ while res.get("status") == "processing": # a new video is still being prepared
145
+ time.sleep(res.get("retry_after", 5))
146
+ res = api.youtube_telegram("https://youtu.be/OORSiK8ScTI", format="720", bot_username="@MyBot")
147
+
148
+ if res["media_type"] == "video":
149
+ bot.send_video(chat_id, res["file_id"]) # your Telegram library's sendVideo
150
+ else:
151
+ bot.send_audio(chat_id, res["file_id"]) # format="mp3" → sendAudio
152
+ ```
153
+
154
+ 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.
155
+
156
+ ### Download TikTok, Instagram, Facebook or X videos
121
157
 
122
158
  ```python
123
159
  for link in [
@@ -129,7 +165,7 @@ for link in [
129
165
  print(media["hosting"], media["download_url"])
130
166
  ```
131
167
 
132
- ### Instagram profile
168
+ ### Instagram profile data
133
169
 
134
170
  ```python
135
171
  profile = api.instagram_profile("cristiano")
@@ -203,6 +239,7 @@ Step-by-step guide: **[Build a Telegram video downloader bot](https://saverapi.n
203
239
  export SAVERAPI_KEY=your_key
204
240
  saverapi download https://www.instagram.com/reel/DPOi9V-CAqH/
205
241
  saverapi youtube https://youtu.be/OORSiK8ScTI --format mp3
242
+ saverapi youtube-telegram https://youtu.be/OORSiK8ScTI --bot @MyBot
206
243
  saverapi youtube-info https://youtu.be/OORSiK8ScTI
207
244
  saverapi instagram cristiano
208
245
  saverapi shazam https://example.com/clip.mp3
@@ -242,6 +279,29 @@ Options: `SaverAPI(api_key=None, timeout=60, base_url=None, session=None, max_re
242
279
  - Keep the API key on your server; mobile and web apps should call your backend.
243
280
  - Respect each platform's terms of service and creators' rights.
244
281
 
282
+ ## FAQ
283
+
284
+ **How do I download a YouTube video in Python?**
285
+ 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.
286
+
287
+ **Can I download YouTube in 4K or 1440p?**
288
+ Yes: `format="2160"` (4K) and `format="1440"` (2K) are supported alongside 1080, 720, 480, 360, 240 and 144, when the video has that quality.
289
+
290
+ **How do I convert YouTube to MP3?**
291
+ `api.youtube(url, format="mp3")` returns a link to the audio file.
292
+
293
+ **How do I download Instagram Reels or TikTok videos in Python?**
294
+ `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.
295
+
296
+ **How do I send a YouTube video from a Telegram bot without uploading it?**
297
+ 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.
298
+
299
+ **Is there a free plan?**
300
+ 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.
301
+
302
+ **Does it work with asyncio?**
303
+ Yes: `pip install "saverapi-client[async]"` and use `AsyncSaverAPI` — same methods, awaited.
304
+
245
305
  ## Links
246
306
 
247
307
  - Website and free API key: https://saverapi.net
@@ -249,13 +309,27 @@ Options: `SaverAPI(api_key=None, timeout=60, base_url=None, session=None, max_re
249
309
  - YouTube Downloader API: https://saverapi.net/youtube-downloader-api
250
310
  - Instagram Downloader API: https://saverapi.net/instagram-downloader-api
251
311
  - TikTok Downloader API: https://saverapi.net/tiktok-downloader-api
312
+ - Facebook Video API: https://saverapi.net/facebook-video-api
313
+ - Twitter / X Video API: https://saverapi.net/twitter-video-api
314
+ - Shazam Song Recognition API: https://saverapi.net/shazam-api
315
+ - Social Media Downloader API: https://saverapi.net/social-media-downloader-api
252
316
  - All-in-One Downloader API: https://saverapi.net/all-in-one-downloader-api
253
317
  - Tutorials: https://saverapi.net/blog
318
+ - [YouTube downloader API in Python](https://saverapi.net/blog/youtube-downloader-api-python)
319
+ - [Build a Telegram YouTube downloader bot](https://saverapi.net/blog/build-telegram-youtube-downloader-bot)
320
+ - [Download Instagram Reels with Python](https://saverapi.net/blog/download-instagram-reels-python)
321
+ - [A yt-dlp API alternative](https://saverapi.net/blog/yt-dlp-api-alternative)
254
322
  - Pricing: https://saverapi.net/pricing
255
323
  - Telegram: https://t.me/SaverAPI
256
324
 
257
325
  ## Changelog
258
326
 
327
+ **2.0.0**
328
+ - YouTube: `api.youtube()` now documents the new `2160` (4K) and `1440` (2K) formats; the full list is exported as `YOUTUBE_FORMATS`.
329
+ - 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`.
330
+ - **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.
331
+ - `format` accepts an `int` as well as a `str` in type hints (`format=720`).
332
+
259
333
  **1.1.0**
260
334
  - New methods covering the whole catalog: `youtube_telegram`, `youtube_info_basic`, `youtube_subtitles`, `instagram_profile`, `photolab`, and `request()` for any endpoint.
261
335
  - `AsyncSaverAPI` for asyncio (`pip install "saverapi-client[async]"`).
@@ -45,28 +45,30 @@ def test_methods_call_the_right_endpoints_and_params():
45
45
  api.download("https://x.com/a/status/1")
46
46
  api.youtube("https://youtu.be/a", format="mp3")
47
47
  api.youtube_telegram("https://youtu.be/a", 360)
48
+ api.youtube_telegram("https://youtu.be/a", "mp3", bot_username="@MyBot")
49
+ api.youtube("https://youtu.be/a", 2160)
48
50
  api.youtube_info("https://youtu.be/a")
49
51
  api.youtube_info_basic("https://youtu.be/a")
50
- api.youtube_subtitles("https://youtu.be/a")
51
52
  api.instagram_profile("@cristiano")
52
53
  api.music_search("hello", 5)
53
54
  api.shazam_recognize("https://e.com/a.mp3")
54
55
  api.shazam_top("uz")
55
- api.photolab(24302596, "https://e.com/p.jpg")
56
56
  api.nsfw_scan("https://e.com/v.mp4")
57
57
  api.info_balance()
58
58
  api.api_keys_statistics()
59
59
  api.request("/new-endpoint", {"q": "x", "none": None})
60
60
  paths = [c[0].replace("https://saverapi.net/api", "") for c in s.calls]
61
61
  assert paths == [
62
- "/all-in-one-downloader-api", "/youtube-api", "/youtube-telegram-base", "/youtube-info-v2", "/youtube-info",
63
- "/youtube-subtitles", "/instagram-profile", "/music-search", "/shazam-recognize", "/shazam-music-top",
64
- "/photolab-api", "/nsfw-scanner-api", "/infobalans", "/api-keys/all-statistics", "/new-endpoint",
62
+ "/all-in-one-downloader-api", "/youtube-api", "/youtube-telegram-base", "/youtube-telegram-base", "/youtube-api",
63
+ "/youtube-info-v2", "/youtube-info", "/instagram-profile", "/music-search", "/shazam-recognize",
64
+ "/shazam-music-top", "/nsfw-scanner-api", "/infobalans", "/api-keys/all-statistics", "/new-endpoint",
65
65
  ]
66
66
  assert s.calls[1][1] == {"url": "https://youtu.be/a", "farmat": "mp3"}
67
+ # Without a bot the parameter is not sent at all.
67
68
  assert s.calls[2][1] == {"url": "https://youtu.be/a", "farmat": "360"}
68
- assert s.calls[6][1] == {"Userinfo": "cristiano"}
69
- assert s.calls[10][1] == {"id": "24302596", "photo": "https://e.com/p.jpg"}
69
+ assert s.calls[3][1] == {"url": "https://youtu.be/a", "farmat": "mp3", "bot_username": "@MyBot"}
70
+ assert s.calls[4][1] == {"url": "https://youtu.be/a", "farmat": "2160"}
71
+ assert s.calls[7][1] == {"Userinfo": "cristiano"}
70
72
  assert s.calls[14][1] == {"q": "x"}
71
73
  assert s.headers["x-api-key"] == "k"
72
74
 
@@ -141,5 +143,49 @@ def test_cli_prints_json(monkeypatch, capsys):
141
143
  assert json.loads(capsys.readouterr().out) == {"plan": "Pro"}
142
144
 
143
145
 
146
+ def test_retired_endpoints_are_gone_and_formats_exported():
147
+ for cls in (SaverAPI, AsyncSaverAPI):
148
+ assert not hasattr(cls, "youtube_subtitles")
149
+ assert not hasattr(cls, "photolab")
150
+ assert saverapi.YOUTUBE_FORMATS[:2] == ("2160", "1440") and "mp3" in saverapi.YOUTUBE_FORMATS
151
+ assert "2160" not in saverapi.YOUTUBE_TELEGRAM_FORMATS
152
+
153
+
154
+ def test_sync_and_async_expose_the_same_endpoints():
155
+ def public(cls):
156
+ skip = {"close", "aclose", "save_file", "BASE_URL"}
157
+ return {n for n in vars(cls) if not n.startswith("_") and n not in skip}
158
+
159
+ assert public(SaverAPI) == public(AsyncSaverAPI)
160
+
161
+
162
+ def test_async_youtube_telegram_sends_bot_username():
163
+ seen = []
164
+
165
+ def handler(request: httpx.Request) -> httpx.Response:
166
+ seen.append(request)
167
+ return httpx.Response(200, json={"status": "success", "file_id": "BAAC"})
168
+
169
+ async def run():
170
+ async with AsyncSaverAPI(api_key="k", client=httpx.AsyncClient(transport=httpx.MockTransport(handler))) as api:
171
+ await api.youtube_telegram("https://youtu.be/a", 720, bot_username="@MyBot")
172
+ return await api.youtube_telegram("https://youtu.be/a")
173
+
174
+ assert asyncio.run(run())["file_id"] == "BAAC"
175
+ assert seen[0].url.path.endswith("/youtube-telegram-base")
176
+ assert dict(seen[0].url.params) == {"url": "https://youtu.be/a", "farmat": "720", "bot_username": "@MyBot"}
177
+ assert "bot_username" not in seen[1].url.params
178
+
179
+
180
+ def test_cli_youtube_telegram(monkeypatch, capsys):
181
+ monkeypatch.setenv("SAVERAPI_KEY", "k")
182
+ got = {}
183
+ monkeypatch.setattr(SaverAPI, "youtube_telegram", lambda self, *a: got.setdefault("args", a) and {"file_id": "x"})
184
+ assert main(["youtube-telegram", "https://youtu.be/a", "--format", "mp3", "--bot", "@MyBot"]) == 0
185
+ assert got["args"] == ("https://youtu.be/a", "mp3", "@MyBot")
186
+ with pytest.raises(SystemExit):
187
+ main(["subtitles", "https://youtu.be/a"])
188
+
189
+
144
190
  def test_version():
145
- assert saverapi.__version__ == "1.1.0"
191
+ assert saverapi.__version__ == "2.0.0"
@@ -1 +0,0 @@
1
- __version__ = "1.1.0"
File without changes