mirror of
https://github.com/kristoferssolo/tg-relay-rs.git
synced 2026-02-04 06:42:09 +00:00
Compare commits
2 Commits
465f9c49e9
...
main
| Author | SHA1 | Date | |
|---|---|---|---|
|
b48cc7ccc5
|
|||
|
a913552511
|
@@ -10,10 +10,10 @@ RUN cargo chef prepare --recipe-path recipe.json
|
|||||||
FROM chef AS builder-rs
|
FROM chef AS builder-rs
|
||||||
COPY --from=planner /app/recipe.json recipe.json
|
COPY --from=planner /app/recipe.json recipe.json
|
||||||
# Build dependencies - this is the caching Docker layer!
|
# Build dependencies - this is the caching Docker layer!
|
||||||
RUN cargo chef cook --release --recipe-path recipe.json
|
RUN cargo chef cook --release --no-default-features --features tiktok --features twitter --features youtube --recipe-path recipe.json
|
||||||
# Build application
|
# Build application
|
||||||
COPY . .
|
COPY . .
|
||||||
RUN cargo build --release --no-default-features -F tiktok -F twitter -F youtube
|
RUN cargo build --release --no-default-features --features tiktok --features twitter --features youtube
|
||||||
|
|
||||||
|
|
||||||
FROM ghcr.io/astral-sh/uv:trixie-slim AS builder-py
|
FROM ghcr.io/astral-sh/uv:trixie-slim AS builder-py
|
||||||
@@ -30,9 +30,12 @@ RUN uv python install 3.13
|
|||||||
|
|
||||||
RUN apt-get update -y \
|
RUN apt-get update -y \
|
||||||
&& apt-get install -y --no-install-recommends \
|
&& 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/*
|
&& 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
|
RUN --mount=type=cache,target=/root/.cache/uv
|
||||||
|
|
||||||
# Intstall deps
|
# Intstall deps
|
||||||
|
|||||||
@@ -106,12 +106,7 @@ async fn run_command_in_tempdir(cmd: &str, args: &[&str]) -> Result<DownloadResu
|
|||||||
#[cfg(feature = "instagram")]
|
#[cfg(feature = "instagram")]
|
||||||
pub async fn download_instagram(url: String) -> Result<DownloadResult> {
|
pub async fn download_instagram(url: String) -> Result<DownloadResult> {
|
||||||
let config = global_config();
|
let config = global_config();
|
||||||
run_yt_dlp(
|
run_yt_dlp(&["-t", "mp4"], config.instagram.cookies_path.as_ref(), &url).await
|
||||||
&["-t", "mp4", "--extractor-args", "instagram:"],
|
|
||||||
config.instagram.cookies_path.as_ref(),
|
|
||||||
&url,
|
|
||||||
)
|
|
||||||
.await
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/// Download a Tiktok URL with yt-dlp.
|
/// Download a Tiktok URL with yt-dlp.
|
||||||
@@ -122,12 +117,7 @@ pub async fn download_instagram(url: String) -> Result<DownloadResult> {
|
|||||||
#[cfg(feature = "tiktok")]
|
#[cfg(feature = "tiktok")]
|
||||||
pub async fn download_tiktok(url: String) -> Result<DownloadResult> {
|
pub async fn download_tiktok(url: String) -> Result<DownloadResult> {
|
||||||
let config = global_config();
|
let config = global_config();
|
||||||
run_yt_dlp(
|
run_yt_dlp(&["-t", "mp4"], config.tiktok.cookies_path.as_ref(), &url).await
|
||||||
&["-t", "mp4", "--extractor-args", "tiktok:"],
|
|
||||||
config.tiktok.cookies_path.as_ref(),
|
|
||||||
&url,
|
|
||||||
)
|
|
||||||
.await
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/// Download a Twitter URL with yt-dlp.
|
/// Download a Twitter URL with yt-dlp.
|
||||||
@@ -138,12 +128,7 @@ pub async fn download_tiktok(url: String) -> Result<DownloadResult> {
|
|||||||
#[cfg(feature = "twitter")]
|
#[cfg(feature = "twitter")]
|
||||||
pub async fn download_twitter(url: String) -> Result<DownloadResult> {
|
pub async fn download_twitter(url: String) -> Result<DownloadResult> {
|
||||||
let config = global_config();
|
let config = global_config();
|
||||||
run_yt_dlp(
|
run_yt_dlp(&["-t", "mp4"], config.twitter.cookies_path.as_ref(), &url).await
|
||||||
&["-t", "mp4", "--extractor-args", "twitter:"],
|
|
||||||
config.twitter.cookies_path.as_ref(),
|
|
||||||
&url,
|
|
||||||
)
|
|
||||||
.await
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/// Download a URL with yt-dlp.
|
/// Download a URL with yt-dlp.
|
||||||
@@ -154,18 +139,17 @@ pub async fn download_twitter(url: String) -> Result<DownloadResult> {
|
|||||||
#[cfg(feature = "youtube")]
|
#[cfg(feature = "youtube")]
|
||||||
pub async fn download_youtube(url: String) -> Result<DownloadResult> {
|
pub async fn download_youtube(url: String) -> Result<DownloadResult> {
|
||||||
let config = global_config();
|
let config = global_config();
|
||||||
run_yt_dlp(
|
let mut args = vec![
|
||||||
&[
|
|
||||||
"--no-playlist",
|
"--no-playlist",
|
||||||
"-t",
|
"-f",
|
||||||
|
"bestvideo[ext=mp4]+bestaudio[ext=m4a]/bestvideo+bestaudio/best",
|
||||||
|
"--merge-output-format",
|
||||||
"mp4",
|
"mp4",
|
||||||
"--postprocessor-args",
|
];
|
||||||
&config.youtube.postprocessor_args,
|
if !config.youtube.postprocessor_args.is_empty() {
|
||||||
],
|
args.extend(["--postprocessor-args", &config.youtube.postprocessor_args]);
|
||||||
config.youtube.cookies_path.as_ref(),
|
}
|
||||||
&url,
|
run_yt_dlp(&args, config.youtube.cookies_path.as_ref(), &url).await
|
||||||
)
|
|
||||||
.await
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/// Post-process a `DownloadResult`.
|
/// Post-process a `DownloadResult`.
|
||||||
|
|||||||
Reference in New Issue
Block a user