From c292b96f068ec2e6323466bed011d5bae9ede662 Mon Sep 17 00:00:00 2001 From: "Zak B. Elep" Date: Thu, 17 Aug 2023 20:41:50 +0800 Subject: [PATCH 1/2] server/net: use yt-dlp instead of youtube-dl youtube-dl no longer even gets URLs properly, so switch to yt-dlp as a drop-in replacement for it. --- server/Dockerfile | 2 +- server/requirements.txt | 2 +- server/szurubooru/func/net.py | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/server/Dockerfile b/server/Dockerfile index 487f1923f..c2640f165 100644 --- a/server/Dockerfile +++ b/server/Dockerfile @@ -29,7 +29,7 @@ RUN apk --no-cache add \ "coloredlogs==5.0" \ "pyheif==0.6.1" \ "heif-image-plugin>=0.3.2" \ - youtube_dl \ + yt-dlp \ "pillow-avif-plugin>=1.1.0" \ && apk --no-cache del py3-pip diff --git a/server/requirements.txt b/server/requirements.txt index 16b29fff6..ceff0b8d1 100644 --- a/server/requirements.txt +++ b/server/requirements.txt @@ -12,4 +12,4 @@ pyRFC3339>=1.0 pytz>=2018.3 pyyaml>=3.11 SQLAlchemy>=1.0.12, <1.4 -youtube_dl +yt-dlp diff --git a/server/szurubooru/func/net.py b/server/szurubooru/func/net.py index c53a62eb3..d6aa95e91 100644 --- a/server/szurubooru/func/net.py +++ b/server/szurubooru/func/net.py @@ -64,7 +64,7 @@ def download(url: str, use_video_downloader: bool = False) -> bytes: def _get_youtube_dl_content_url(url: str) -> str: - cmd = ["youtube-dl", "--format", "best", "--no-playlist"] + cmd = ["yt-dlp", "--format", "best", "--no-playlist"] if config.config["user_agent"]: cmd.extend(["--user-agent", config.config["user_agent"]]) cmd.extend(["--get-url", url]) From 59c497e1689fe5ff1c09c1882c04d789f9e32918 Mon Sep 17 00:00:00 2001 From: "Zak B. Elep" Date: Thu, 17 Aug 2023 20:58:09 +0800 Subject: [PATCH 2/2] doc: update for yt-dlp --- README.md | 2 +- doc/API.md | 6 +++--- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/README.md b/README.md index 930705574..6a38501c8 100644 --- a/README.md +++ b/README.md @@ -8,7 +8,7 @@ scrubbing](https://sjp.pwn.pl/sjp/;2527372). It is pronounced as *shoorubooru*. ## Features - Post content: images (JPG, PNG, GIF, animated GIF), videos (MP4, WEBM), Flash animations -- Ability to retrieve web video content using [youtube-dl](https://github.com/ytdl-org/youtube-dl) +- Ability to retrieve web video content using [yt-dlp](https://github.com/yt-dlp/yt-dlp) - Post comments - Post notes / annotations, including arbitrary polygons - Rich JSON REST API ([see documentation](doc/API.md)) diff --git a/doc/API.md b/doc/API.md index f588c89d9..e10802ab6 100644 --- a/doc/API.md +++ b/doc/API.md @@ -165,9 +165,9 @@ way. The files, however, should be passed as regular fields appended with a accepts a file named `content`, the client should pass `{"contentUrl":"http://example.com/file.jpg"}` as a part of the JSON message body. When creating or updating post content using this method, the server can -also be configured to employ [youtube-dl](https://github.com/ytdl-org/youtube-dl) -to download content from popular sites such as youtube, gfycat, etc. Access to -youtube-dl can be configured with the `'uploads:use_downloader'` permission +also be configured to employ [yt-dlp](https://github.com/yt-dlp/yt-dlp) to +download content from popular sites such as youtube, gfycat, etc. Access to +yt-dlp can be configured with the `'uploads:use_downloader'` permission Finally, in some cases the user might want to reuse one file between the requests to save the bandwidth (for example, reverse search + consecutive