A simple website for hosting your archived YouTube videos.
This project is a rewrite of pocket-youtube
in Node.js.
You will need the following software (ignore if you are using Docker):
-
Install the required Node.js packages and build the application.
npm install npm run build
-
Create a file
.env
containing your PostgreSQL database credentials.DB_HOST="localhost" DB_USERNAME="username" DB_PASSWORD="password" DB_DATABASE="youtube"
-
Create a symbolic link to your video library.
ln -s /path/to/video/library videos
-
Run the database initialization script. See Video Indexing for details.
npm run init_db
-
Finally, start the application.
npm start
youtube-dl
and its derivatives have several options, two of which are important for archiving YouTube videos:
--write-info-json
--write-thumbnail
To use this application, you must have the .info.json
metadata files.
Technically, everything else is optional.
You do not need to have thumbnails or even the videos for this application to work correctly.
Your videos/
directory may be structured however you wish, with one restriction.
For each .info.json
file, the corresponding video and thumbnail files must have the same directory name and file name (not including extension).
The database initialization script init_db
reads line-by-line from standard input.
Each line shall be a path to a .info.json
file.
You can manually type in each path, or use something like find
to output the paths automatically.
Here is an example which will index every video in the videos
directory.
find videos/ -type f -name "*.info.json" | npm run init_db
As of right now, there is no separate functionality to add or remove videos.
Each invocation of init_db
will completely replace the database contents.
Therefore, it may be helpful to use a text file to gather all of your paths beforehand.
Here is another example which indexes specific subdirectories.
for x in foo bar baz; do
find videos/$x/ -type f -name "*.info.json"
done | npm run init_db
docker compose up
Like before, the database must be initialized manually.
docker compose exec -T app npm run init_db