GithubHelp home page GithubHelp logo

tvpsh2021 / discord-youtube-notifier Goto Github PK

View Code? Open in Web Editor NEW

This project forked from winsuk/discord-youtube-notifier

0.0 0.0 0.0 571 KB

YouTube upload/livestream notification via Discord webhook

License: MIT License

PHP 88.58% Shell 11.42%

discord-youtube-notifier's Introduction

YouTube upload/livestream notification via Discord webhook

Notifies for:

  • Standard video upload:

Standard video upload

  • Livestreams starting (option for gaming.youtube.com link, enabled by default):

Livestream starting

  • Livestreams that have just ended, with a link to watch (option to disable):

Livestream finished

Usually is faster than an email from YouTube of the same video

Requirements:

  • PHP webserver with curl
    • (could easily be converted to some other server/language though)
  • Permission for PHP to create a file in the same directory
    • I assumed this was pretty standard, but I ran into it recently so I'm listing it here. After a notification shows in Discord, there should be a ytnotify.latest file on the webserver - if not, something is broken.

Setup:

  • Create a webhook on Discord (edit a text channel > Webhooks > Create Webhook)
  • Follow steps 1 - 3 under "Before you start" on https://developers.google.com/youtube/v3/getting-started to create a server API key
  • Edit ytnotify.php with a text editor:
  • Upload ytnotify.php to a public location on your webserver
  • Edit ytnotify_subscribe.sh/php with a text editor:
    • Change REPLACE_WITH_CHANNEL_ID to your YouTube channel ID
    • Change REPLACE_WITH_CALLBACK_URL to the public URL of ytnotify.php (including http[s]://)
    • Change REPLACE_WITH_UNIQUE_SECRET to the same secret set in ytnotify.php

ytnotify_subscribe needs to be run regularly - the subscription times out after a set time (432000 seconds/5 days last I checked). This is best done with a cronjob on the server - I have mine run at 5am every Monday and Friday.

Since it falls back to notifying when there's no last known publish date, the first notification could be from a title or description change.

Known issues:

  • Keeping track of the last publish time with a file is probably not the best, and should be changed eventually...

discord-youtube-notifier's People

Contributors

winsuk avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.