2.0.2 • Published 2 years ago

youtube-notify v2.0.2

Weekly downloads
-
License
MIT
Repository
github
Last release
2 years ago

youtube-notify

Simple Youtube Channel Subscription Notification push framework with Typescript and Javascript supported by Pubsubhubbub.

This allows you grab notifications from updates of any Youtube channel including video updating, publishing.

Also provides a simple subscribe and unsubscribe system.

Install

npm install youtube-notify
yarn add youtube-notify

Example Usage

Compatible with Javascript and Typescript.

// Javascript
const Notifier = require('youtube-notify')

//Typescript
import Notifier from 'youtube-notify'

// Options
const notifier = new Notifier({
  hubCallback: 'https://example.com/youtube',
  port: 8080,
  secret: 'Something',
  path: '/youtube',
})
// Setup
notifier.setup()
// Notification
notifier.on('notified', (data) => {
  console.log('New Video')
  console.log(
    `${data.channel.name} just uploaded a new video titled: ${data.video.title}`
  )
})
// Subscription
notifier.subscribe('CHANNEL_ID') // String
notifier.subscribe(['CHANNEL_ID1', 'CHANNEL_ID2']) // Array