![logo](assets/vidzig.svg) # Vidzig — Video download server Vidzig is a HTTP server that allows you to enqueue links to videos. If Vidzig is unpaused, it will begin spawning `yt-dlp` to download these videos. These videos are accessible via a web interface or a (as yet undocumented) JSON API. ## Why? I have terrible internet and can't watch videos in 1080p, so I collect them up over a day and have a Rasperry Pi running vidzig download them overnight. ## Building 1. Install the [Zig](https://ziglang.org) 0.12.0 compiler and a [Haxe](https://haxe.org/) compiler for the frontend. 2. `zig build` 3. If that doesn't work, bug me about it ## Deployment ### **NEVER DEPLOY VIDZIG OUTSIDE YOUR LAN!** Not only would that make absolutely no sense, but also, vidzig has not been tested against path traversal attacks, and while there are some (buggy) checks in place, these will almost certainly not hold up to real attacks! ### NixOS The repository contains a NixOS module. You may pull it in as a flake and use it with Nix like any other service. 1. Install `yt-dlp` on the server. Yes, I know. Dependency on some python trash, but I sadly don't know any good alternatives :(. 2. Create a JSON configuration file in a directory of your choice (I recommend `/etc/vidzig/conf.json`) This is an example JSON file. **Note that comments and trailing commas are not supported in the actual config!** All values are required unless noted otherwise. ```json5 { // Address and port to bind to. Use 0.0.0.0 to allow access from other devices. "bind": { "ip": "127.0.0.1", "port": 8080, }, // Directory to use for saving data such as videos. "data_dir": "/mnt/storage/vidzig", // Base URL vidzig is accessible from. This is useful if vidzig is running behind a reverse proxy. "base_url": "http://my.host/vidzig", // (optional) Command for youtube-dl. // // Accepts these format string templates: // - %u: URL // - %o: Output file template // // Vidzig might append options to this depending on the options checked on the frontend. "ytdl_argv": [ "yt-dlp", "%u", "--quiet", "--embed-metadata", "--embed-subs", "--output", "%o", ], // Format to pass to ytdl when downloading videos. "video_format": "bestvideo[height<=1080]+bestaudio/best[height<=1080]", // Format to pass to ytdl when downloading audio only. "audio_format": "ba[acodec=opus]/ba", // Automatically pause after queue has been completed // Default: true "autopause": true, } ``` 3. Run the binary and pass the config file path as an argument: `/path/to/vidzig /path/to/conf.json` There is also a `vidzig.service` file for managing Vidzig using SystemD.