diff --git a/Dockerfile b/Dockerfile index 491769a..f5d4f8f 100644 --- a/Dockerfile +++ b/Dockerfile @@ -45,14 +45,20 @@ COPY --from=web-builder /src/web/dist /src/web/dist RUN touch src/main.rs && \ cargo build --locked --release --target x86_64-unknown-linux-musl +# Build ytarchive +FROM golang:1.20-alpine AS ytarchive-builder +WORKDIR /src +RUN set -ex; \ + apk add --no-cache git; \ + git clone https://github.com/Kethsar/ytarchive.git; \ + cd ytarchive; \ + git checkout b40d0a1fb70e59aff2c8642f265d3cd653c1a75d; \ + go build . + FROM alpine AS runner WORKDIR /app -RUN set -ex; \ - apk add --no-cache ffmpeg wget unzip; \ - wget -O /app/ytarchive.zip https://github.com/Kethsar/ytarchive/releases/download/v0.3.2/ytarchive_linux_amd64.zip; \ - unzip /app/ytarchive.zip -d /usr/local/bin/; \ - rm /app/ytarchive.zip; \ - apk del wget unzip; +RUN apk add --no-cache ffmpeg +COPY --from=ytarchive-builder /src/ytarchive/ytarchive /usr/local/bin/ytarchive USER 1000 COPY --from=rust-builder --chown=1000:1000 \ diff --git a/src/youtube/mod.rs b/src/youtube/mod.rs index 0a9bef6..7e1f5a8 100644 --- a/src/youtube/mod.rs +++ b/src/youtube/mod.rs @@ -53,6 +53,10 @@ impl URL { return Some(path[1..].to_string()); } + if path.starts_with("/live/") { + return Some(path[6..].to_string()); + } + if path == "/watch" { return self .parsed_uri