3 Commits

Author SHA1 Message Date
8b28537fb8 chore: build youtube-dl from source 2019-12-31 14:44:34 -07:00
db731053fc docs: add url usage example 2019-12-31 14:44:28 -07:00
8623e6be8d docs: fix build and publish instructions 2019-12-31 14:33:39 -07:00
2 changed files with 33 additions and 9 deletions

View File

@@ -1,17 +1,37 @@
# create build from source
FROM python:3 AS build
WORKDIR /build
RUN set -xe \
&& apt-get update -y \
&& apt-get install -y zip pandoc \
&& curl -L https://github.com/ytdl-org/youtube-dl/archive/master.zip -o youtube-dl-master.zip \
&& unzip youtube-dl-master.zip
WORKDIR /build/youtube-dl-master
RUN set -xe \
&& make
# add the build to the web container
FROM node:12-alpine
# install youtube-dl
WORKDIR /app
# copy the build
COPY --from=build /build/youtube-dl-master/youtube-dl /usr/local/bin
# install dependencies
RUN set -xe \
&& chmod a+rx /usr/local/bin/youtube-dl \
&& apk add --no-cache ca-certificates \
ffmpeg \
openssl \
python3 \
&& pip3 install --upgrade pip \
&& pip3 install youtube-dl
&& ln -s /usr/bin/python3 /usr/bin/python
# install app dependencies
WORKDIR /app
RUN npm install -g yarn
COPY package.json yarn.lock ./
RUN yarn install

View File

@@ -13,7 +13,11 @@ Meant to be used with Docker, but it would work locally if you have [youtube-dl]
docker run -it --rm -p 8080:8080 -v $PWD/data:/app/data w33ble/youtube-dl-web
```
Then hit `http://localhost:8080`, passing in a `url` and optionally a `format` query parameter for where to download from.
Then hit `http://localhost:8080`, passing in a `url` and optionally a `format` query parameter for where to download from. For example:
```text
http://localhost:8080?url=https://www.youtube.com/watch?v=YE7VzlLtp-4
```
### Automatic cleanup
@@ -30,9 +34,9 @@ Running it like this, the result from youtube-dl will only be useful from the we
## Deploy to Docker Hub
```sh
docker build . -t youtube-dl
docker tag youtube-dl USERNAME/youtube-dl:latest
docker push USERNAME/youtube-dl:latest
docker build . -t youtube-dl-web
docker tag youtube-dl w33ble/youtube-dl-web:latest
docker push w33ble/youtube-dl-web:latest
```
## License