YT-DLP Server is an server side for yt-dlp that can allow you run it in your server.
- Server side is English but the webpage is in all chinese, you can translate it.
- No download speed or duration for display.
- Depend on Flask.
- Easy use API, RESTful-API style respond.
- Multi-threaded download task.
- User-friendly interactive and interface.
- Server with single python file, webpage with single HTML file, easy for learning.
You need to install aria2 first because this script depends on aria2 for more quickly download speed.
$ python -m venv ytdlp-server
$ cd ytdlp-server
- For Windows
$ .\Scripts\Activate.ps1
- For other platform
$ source bin/activate
$ git clone https://github.com/shadlc/ytdlp-server.git
$ cd ytdlp-server
$ pip install -r requirements.txt
$ python3 ytdlp-server.py
When started this script, you can download videos to server via yt-dlp. You can modify the configuration file "config.json".
Directly download the video via yt-dlp.
- url: The url that input for yt-dlp.
-
GET http://127.0.0.1:8848/download?url=https://www.youtube.com/watch?v=dQw4w9WgXcQ
POST http://127.0.0.1:8848/download
-
url: The url that input for yt-dlp.
cookie: Base64 encode Netscape format cookie file.
format: The video format selector for yt-dlp.
{
"code": 200,
"status": "Added",
"data": {
"title": "Rick Astley - Never Gonna Give You Up (Official Music Video)",
"url": "https://www.youtube.com/watch?v=dQw4w9WgXcQ",
"cookie": "youtube",
"format": "bv*+ba/b",
"type": "video",
"uploader": "Rick Astley",
"site": "youtube",
"thumbnail": "https://i.ytimg.com/vi_webp/dQw4w9WgXcQ/maxresdefault.webp",
"id": "dQw4w9WgXcQ",
"duration": 212,
"resolution": "1920x1080",
"ext": "webm",
"size": 3437753
}
}
Get video information via yt-dlp.
- url: The url that input for yt-dlp.
- mode: Default is "brief" and optional in "brief" or "raw".
-
GET http://127.0.0.1:8848/info?url=https://www.youtube.com/watch?v=dQw4w9WgXcQ
POST http://127.0.0.1:8848/info
-
url: The url that input for yt-dlp.
mode: Default is "brief" and optional in "brief" or "raw".
cookie: Base64 encode Netscape format cookies file.
format: The video format selector for yt-dlp.
{
"code": 200,
"status": "Success",
"data": {
"title": "Rick Astley - Never Gonna Give You Up (Official Music Video)",
"url": "https://www.youtube.com/watch?v=dQw4w9WgXcQ",
"cookie": "youtube",
"format": "bv*+ba/b",
"type": "video",
"uploader": "Rick Astley",
"site": "youtube",
"thumbnail": "https://i.ytimg.com/vi_webp/dQw4w9WgXcQ/maxresdefault.webp",
"id": "dQw4w9WgXcQ",
"duration": 212,
"resolution": "1920x1080",
"ext": "webm",
"size": 3437753
}
}
Get the status about download task.
- None
GET http://127.0.0.1:8848/status
{
"code": 200,
"status": "Init",
"data": {
"tasks": []
}
}
Get the history you downloaded.
- None
GET http://127.0.0.1:8848/history
{
"code": 400,
"status": "No history yet",
"data": ""
}
Clear the downloading list.
- None
GET http://127.0.0.1:8848/clear_download
{
"code": 400,
"status": "Cleared",
"data": ""
}
Clear the download history.
- None
GET http://127.0.0.1:8848/clear_history
{
"code": 400,
"status": "Cleared",
"data": ""
}