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

@livecord/notify

Package Overview
Dependencies
Maintainers
2
Versions
20
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@livecord/notify - npm Package Compare versions

Comparing version 1.0.4 to 1.0.5

livecord.json

4

examples/youtube.test.js
const { YouTube } = require('../src/index');
const youtube = new YouTube({
channels: [ 'UCaZGQt419Ptsdk_lh2mz9lQ', 'UCna9_me1UQAu3zbxv-dIhCQ' ], // Array of channels (required)
channels: [], // Array of channels (required)
interval: 1000, // check channels every 1000ms (1 second) (optional) (default: 60000 [60 seconds])])

@@ -8,2 +8,4 @@ useDatabase: true // use database to store videos (optional) (default: true)

youtube.subscribe('UCaZGQt419Ptsdk_lh2mz9lQ'); // Subscribe to a channel
youtube.on('ready', (ready) => {

@@ -10,0 +12,0 @@ console.log('Youtube connected at: ', ready);

{
"name": "@livecord/notify",
"version": "1.0.4",
"version": "1.0.5",
"description": "Notifier for Youtube and Twitch.",

@@ -5,0 +5,0 @@ "main": "./src/index.js",

@@ -31,5 +31,9 @@ const EventEmitter = require('events');

if (useDatabase) {
JSON.parse(fs.readFileSync('videos.json')).forEach(video => {
if (!this.postedVideos.includes(video)) this.postedVideos.push(video);
});
if (fs.existsSync('./livecord.json')) {
JSON.parse(fs.readFileSync('livecord.json')).forEach(video => {
if (!this.postedVideos.includes(video)) this.postedVideos.push(video);
});
} else {
fs.writeFileSync('livecord.json', JSON.stringify([]));
}
}

@@ -44,10 +48,6 @@ this.emit('ready', Date.now());

if (postedVideos.includes($.id)) return;
if (!fs.existsSync('videos.json')) {
fs.writeFileSync('videos.json', JSON.stringify([$.id]));
} else {
fs.writeFileSync('videos.json', JSON.stringify([
...JSON.parse(fs.readFileSync('videos.json')),
$.id
]));
}
fs.writeFileSync('livecord.json', JSON.stringify([
...JSON.parse(fs.readFileSync('livecord.json')),
$.id
]));
this.postedVideos.push($.id);

@@ -69,2 +69,14 @@ return this.emit('upload', $);

};
subscribe(channel) {
if (!channel) throw new Error('LivecordYoutube: channel is required');
if (typeof channel === 'string') {
this.channels.push(channel);
} else if (Array.isArray(channel)) {
channel.forEach(c => {
this.channels.push(c);
})
} else {
throw new Error('LivecordYoutube: channel must be a string or array');
}
}
};
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