From b48cc7ccc5636298ee855e158f113b9cf4edb0b6 Mon Sep 17 00:00:00 2001 From: Kristofers Solo Date: Sat, 17 Jan 2026 15:29:31 +0200 Subject: [PATCH] fix: add nodejs dependency --- Dockerfile | 5 ++++- src/download.rs | 44 ++++++++++++++------------------------------ 2 files changed, 18 insertions(+), 31 deletions(-) diff --git a/Dockerfile b/Dockerfile index 1cf0c66..d7a077c 100644 --- a/Dockerfile +++ b/Dockerfile @@ -30,9 +30,12 @@ RUN uv python install 3.13 RUN apt-get update -y \ && apt-get install -y --no-install-recommends \ - pkg-config libssl-dev ca-certificates ffmpeg \ + pkg-config libssl-dev ca-certificates ffmpeg curl unzip \ && rm -rf /var/lib/apt/lists/* +# Install Deno (required by yt-dlp for YouTube challenge solving) +RUN curl -fsSL https://deno.land/install.sh | DENO_INSTALL=/usr/local sh + RUN --mount=type=cache,target=/root/.cache/uv # Intstall deps diff --git a/src/download.rs b/src/download.rs index 02bda3d..25987a7 100644 --- a/src/download.rs +++ b/src/download.rs @@ -106,12 +106,7 @@ async fn run_command_in_tempdir(cmd: &str, args: &[&str]) -> Result Result { let config = global_config(); - run_yt_dlp( - &["-t", "mp4", "--extractor-args", "instagram:"], - config.instagram.cookies_path.as_ref(), - &url, - ) - .await + run_yt_dlp(&["-t", "mp4"], config.instagram.cookies_path.as_ref(), &url).await } /// Download a Tiktok URL with yt-dlp. @@ -122,12 +117,7 @@ pub async fn download_instagram(url: String) -> Result { #[cfg(feature = "tiktok")] pub async fn download_tiktok(url: String) -> Result { let config = global_config(); - run_yt_dlp( - &["-t", "mp4", "--extractor-args", "tiktok:"], - config.tiktok.cookies_path.as_ref(), - &url, - ) - .await + run_yt_dlp(&["-t", "mp4"], config.tiktok.cookies_path.as_ref(), &url).await } /// Download a Twitter URL with yt-dlp. @@ -138,12 +128,7 @@ pub async fn download_tiktok(url: String) -> Result { #[cfg(feature = "twitter")] pub async fn download_twitter(url: String) -> Result { let config = global_config(); - run_yt_dlp( - &["-t", "mp4", "--extractor-args", "twitter:"], - config.twitter.cookies_path.as_ref(), - &url, - ) - .await + run_yt_dlp(&["-t", "mp4"], config.twitter.cookies_path.as_ref(), &url).await } /// Download a URL with yt-dlp. @@ -154,18 +139,17 @@ pub async fn download_twitter(url: String) -> Result { #[cfg(feature = "youtube")] pub async fn download_youtube(url: String) -> Result { let config = global_config(); - run_yt_dlp( - &[ - "--no-playlist", - "-t", - "mp4", - "--postprocessor-args", - &config.youtube.postprocessor_args, - ], - config.youtube.cookies_path.as_ref(), - &url, - ) - .await + let mut args = vec![ + "--no-playlist", + "-f", + "bestvideo[ext=mp4]+bestaudio[ext=m4a]/bestvideo+bestaudio/best", + "--merge-output-format", + "mp4", + ]; + if !config.youtube.postprocessor_args.is_empty() { + args.extend(["--postprocessor-args", &config.youtube.postprocessor_args]); + } + run_yt_dlp(&args, config.youtube.cookies_path.as_ref(), &url).await } /// Post-process a `DownloadResult`.