ymi.js

0.1.3 • Public • Published

ymi.js

Build Status Downloads Npm Version Node Version Issues

ymi.js is heavy influenced by the awesome tmi.js providing basic functionality to get a Youtube stream's chat messages from the Youtube API

Install

Node

npm install ymi.js --save

Usage

Node

const ymi = require('ymi')

const config = {
    oauth : {
        client_id: "1394...apps.googleusercontent.com",
        client_secret: "-mHmFvwL...",
        access_token: "ya29...",
        refresh_token: "1/zz_dq0vjjWc..."
    },
    live_chat_id: 'EiEKGFV...',
    page_token: null,
}

const client = new ymi.client(config)

client.on('connected', () => {
    console.log("connected")
})

client.on('chat', (user, message) => {
    console.log(user.displayName, message.displayMessage)
})

client.on('page_token', (page_token) => {

    console.log("New page token", page_token)
    // TODO: Persist to disk
})

client.on('refresh_token', (refresh_token) => {

    console.log("New refresh token", refresh_token)
    // TODO: Persist to disk
})

client.connect()
// Send a message to the stream's chat
client.say("Test message")

Package Sidebar

Install

npm i ymi.js

Weekly Downloads

1

Version

0.1.3

License

MIT

Last publish

Collaborators

  • m3talstorm