Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

@livecord/notify

Package Overview
Dependencies
Maintainers
3
Versions
20
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@livecord/notify

Notifier for YouTube and Twitch.

  • 1.2.2
  • Source
  • npm
  • Socket score

Version published
Weekly downloads
2
increased by100%
Maintainers
3
Weekly downloads
 
Created
Source

@livecord/notify

Do you need my help? Visit our Discord server.

NPM Downloads License

Node Version: 16.15.0

Installation

npm i @livecord/notify --save
# or
yarn add @livecord/notify

Twitch

// ESM
//import { Twitch } from '@livecord/notify'; 

// CJS
const { Twitch } = require("@livecord/notify");

const twitch = new Twitch({ 
    client: {
        id: "YOUR_CLIENT_ID", // Your client ID
        token: "YOUR_TOKEN_HERE", // https://dev.twitch.tv/docs/authentication/getting-tokens
    },
    interval: 60000 // check channels every (optional) (default: 60000 [60 seconds])
});

twitch.on("ready", (ready) => {
    twitch.follow([ "clqu_" ]);
    twitch.unfollow([ "clqu_" ]);

    console.log("Twitch connected at: ", ready);
});

twitch.on("live", channel => {
    console.log(channel.user_name + " is live!");
});

twitch.on("offline", channel => {
    console.log(channel.user_name + " is offline!");
});

// Other Functions
// twitch.getUser('user_login_name');
// twitch.getLive('user_login_name');
How to get Twitch Token?
// ESM
//import { Twitch } from '@livecord/notify'; 

// CJS
const { Twitch } = require("@livecord/notify");

Twitch.getToken("CLIENT_ID", "CLIENT_SECRET").then(token => {
    console.log(token);
}).catch(err => {
    console.log(err);
})
Data of Channel
{
    "id": "",
    "user_id": "",
    "user_login": "",
    "user_name": "",
    "game_id": "",
    "game_name": "",
    "type": "live",
    "title": "",
    "viewer_count": 0,
    "started_at": "",
    "language": "",
    "thumbnail_url": "",
    "tag_ids": [ "" ],
    "is_mature": true
}

Youtube

// ESM
//import { YouTube } from '@livecord/notify'; 

// CJS
const { YouTube } = require("@livecord/notify");

const youtube = new YouTube({
    interval: 60000, // check channels every 1000ms (1 second) (optional) (default: 60000 [60 seconds])]) 
    useDatabase: true // use database to store videos (optional) (default: true)
});

youtube.on("ready", (ready) => {
    youtube.subscribe("UC00_j4mtyaMbWX62JWBMmWA"); // Subscribe to a another channel
    // For multiple: youtube.subscribe(["", ""]);

    youtube.unsubscribe("UC00_j4mtyaMbWX62JWBMmWA"); // Unsubscribe to any added channels
    // For multiple: youtube.unsubscribe(["", ""]);

    console.log("Youtube connected at: ", ready);
});

youtube.on("upload", video => {
    console.log("Youtube new video!", video);
})
Data of Video
{
  "title": "",
  "link": "",
  "pubDate": "",
  "author": "",
  "id": "",
  "isoDate": ""
}

Developed with ❤️ by Livecord

Keywords

FAQs

Package last updated on 20 Jun 2022

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc