This project lets you download Youtube videos in bulk as well as whole playlists
as long as they are marked public or unlisted.
It is based on the amazing work of LuanRT who
created a bunch of utilities to manipulate Youtube video and audio streams.
This project is powered by Bun, so you
must install it to get the proper environment.
To install the project's dependencies, type the following command, once in the project's directory :
bun installTo download a single Youtube video, use the following command :
bun cmd:video --video-id <video-id> --output-folder ./video-streamsThis will download both the audio and video streams, in separate files.
If you want to build a compiled binary instead, use this instead :
bun build:cmd:video
./bin/youtube-video-downloader --video-id <video-id> \
--output-folder ./video-streamsTo download a list of Youtube videos, use the following command :
bun cmd:videos --output-folder ./videos \
--video-id <video-id-1> \
--video-id <video-id-2> \
--video-id <video-id-3>This will download all video streams in the same folder. Both audio and video streams are still stored in separate files, but in the same folder overall.
If you want to build a compiled binary instead, use this instead :
bun build:cmd:videos
./bin/youtube-videos-downloader --output-folder ./videos \
--video-id <video-id-1> \
--video-id <video-id-2> \
--video-id <video-id-3>To download a whole Youtube playlist, use the following command :
bun cmd:playlist --playlist-id <playlist-id> --output-folder ./playlistThis will download all video streams in the same folder. Both audio and video streams are still stored in separate files, but in the same folder overall.
If you want to build a compiled binary instead, use this instead :
bun build:cmd:playlist
./bin/youtube-playlist-downloader --playlist-id <playlist-id> \
--output-folder ./playlistIf you want to build all the binaries directly, use the following command :
bun build:cliAll binaries will be output to the bin folder.
A web application can be deployed in order to let you use the features easily.
Powered by Hono and Nuxt, it can
create different workers to treat the download process asynchronously while
providing a responsive user interface.
Beforehand, make sure both Redis and MinIO servers are reachable. To make it
easier, a docker-compose.development.yml file is placed in the deploy/
directory to let you deploy those two applications locally and easily.
You can make sure they both are started using the following command :
docker compose -f deploy/docker-compose.development.yml up \
ypd-minio \
ypd-redis \
-dThen, you will have to install dependencies :
bun install
cd web/backend && bun install && cd -
cd web/frontend && pnpm install && cd -To deploy the app for development purposes, you can type the following command to start the web services :
bun web:backend:dev # run the backend service
bun web:frontend:dev # run the frontend serviceThen, the backend and frontend applications should be reachable on port 3000
and 4000 respectively.
To deploy the app, you can choose between two different kinds of deployments :
development: builds the Docker image from the repository,production: pull the Docker image from the GitHub repository.
You can use the following command to deploy :
docker compose -f deploy/docker-compose.[deployment-type].yml upIf everything works as expected, you should be able to access the frontend app
on port 8081.
To use the account playlists feature, you need OAuth2 credentials:
-
Go to the
Google Cloud Console. -
Create a project and generate OAuth2 credentials (Client ID & Client Secret).
-
Set the redirect URIs :
- for local development :
http://localhost:4000/oauth/callback, - for local production :
http://localhost:8081/oauth/callback.
- Add your credentials in
.env(or.env.production.local)
# ./web/frontend/.env
BACKEND_API=http://localhost:3000
GOOGLE_CLIENT_ID=...-....apps.googleusercontent.com
GOOGLE_CLIENT_SECRET=GOCSPX-...-...
PORT=3001FFmpeg: convertion and muxing
This project exposes ways to convert audio and video streams as well as muxing them together. This will be mostly wanted for Apple Music enjoyers as it will let you convert audio files with thumbnail and audio metadata included in a file that is ready to be imported in the app.
MinIO: file archiving
All downloaded, and converted, files will end up in a local S3 server to store the content, in case it gets deleted from Youtube or simply to give you a way to export your favorite artifacts easily.