Youtube to Discord webhooks
Configuration is done using environment variables:
CALLBACK
- the URL your HTTP server is listening onHOOKURL
- the URL to the Discord webhook (what's this?)
PORT
- change the port of the HTTP listener, 8000 by defaultCHID
- Youtube ID of the channel you want to subscribe to, UC1CSCMwaDubQ4rcYCpX40Eg by defaultUA
- the user-agent string used when making the POST request to Discord, ytdsc by default; you probably shouldn't change thisUPLOAD_MESSAGE
- override the "New upload:" in the example above with your own custom message, so you can @everyone to your hearts content.
Running the application is supported via Docker or directly using node. System requirements marked with a star (*) may work using older versions, but older versions are not supported.
Requires Docker daemon 19.03* or newer.
docker pull docker.pkg.github.com/3ventic/ytdsc/ytdsc:latest
docker run -e 'CALLBACK=http://example.com:8000/' -e 'HOOKURL=https://discord.com/api/webhooks/...' -e 'CHID=youtube-channel-id-here' -e 'PORT=8000' -p '8000:8000/tcp' --restart=always docker.pkg.github.com/3ventic/ytdsc/ytdsc:latest
Requires docker-compose 1.13.0 or above.
- Copy
docker-compose.override.example.yml
intodocker-compose.override.yml
- Edit the environment variables in the override.yml as documented above.
- Start the service using
docker-compose up -d
Requires node 12* or above, and npm 6* or above.
Recommended to run with screen
or tmux
or similar. Syntax below assumes bash or compatible shell. On Windows use Powershell and $env:VARIABLE = 'value'
syntax.
$ npm install
$ CALLBACK=http://example.com:8000/ HOOKURL=https://discordapp.com/api/webhooks/... CHID=UCS1mJfvqhIuv0-MREnvTZIA node hook.js
Requires node 12* or above, and npm 6* or above.
- Copy
ytdsc.service
into/etc/systemd/system/ytdsc.service
- Edit the enrivonment variables in the file.
- (Optional) Edit other unit configuration to match your needs.
- Run
systemctl daemon-reload
to pick up the new service. - Run
systemctl start ytdsc.service
- (Recommended) Run
systemctl enable ytdsc.service
to automatically start the service on reboot.