Research
Security News
Malicious npm Packages Inject SSH Backdoors via Typosquatted Libraries
Socket’s threat research team has detected six malicious npm packages typosquatting popular libraries to insert SSH backdoors.
youtube-comment-api
Advanced tools
A Node.js API for the YouTube comment system. Scrapes comments and comment information from a given YouTube video on demand.
This project is in no way affiliated with YouTube.
Install as a module via npm.
$ npm install youtube-comment-api
http//www.youtube.com/watch?v={videoID}
var fetchCommentPage = require('youtube-comment-api')(config)
fetchCommentPage(videoID, pageToken, cb);
Parameter | Meaning |
---|---|
config | (optional) module coniguration |
videoID | ID of youtube Video |
pageToken | (optional) token of page to be requested |
callback | (optional) callback function |
var fetchCommentPage = require('youtube-comment-api')();
// request first page of comments (most recent)
fetchCommentPage('{videoID}').then(function (commentPage) {
console.log(commentPage);
return commentPage.nextPageToken;
}).then(function (pageToken) {
// request next page
return fetchCommentPage('{videoID}', pageToken)
}).then(function (commentPage) {
console.log(commentPage);
});
var fetchCommentPage = require('youtube-comment-api')();
// request first page of comments (most recent)
fetchCommentPage('{videoID}', function (err, commentPage) {
if (err) throw err;
console.log(commentPage);
// request next page
fetchCommentPage('{videoID}', commentPage.nextPageToken, function(err, commentPage) {
if (err) throw err;
console.log(commentPage);
});
});
Below are the possible configuration options and their default values.
var fetchCommentPage = require('youtube-comment-api')({
includeReplies: true,
includeVideoInfo: true,
fetchRetries: 3,
sessionTimeout: 60 * 30, // 30 minutes
cacheDuration: 60 * 30, // 30 minutes
cacheInterval: 60 * 5 // 5 minutes
});
Option | Meaning |
---|---|
includeReplies | Also fetch replies for each comment (default: true) |
includeVideoInfo | Fetch meta information about video (default: true) |
fetchRetries | The number of retries if a fetch fails (default: 3) |
sessionTimeout | Number of seconds after which the acquired session token is discarded and a new one is requested. (default: 30 mins) |
cacheDuration | Number of seconds after which cached video meta info will be discarded (default: 30 mins) |
cacheInterval | Length of the interval in seconds at which the video meta info cache entries are checked and discarded if expired. (default 5 mins) |
{
pageToken: {{ page token of current page }},
nextPageToken: {{ page token of next page }},
videoCommentCount: {{ number of comments on the video }},
videoTitle: {{ video title }},
videoThumbnail: {{ URL to video Thumbnail }},
comments: [
{
id: {{ comment ID }},
user: {{ username of author }},
date: {{ how long ago the comment was posted }},
commentText: {{ the comment }},
timestamp: {{ timestamp based on date }},
likes: {{ number of upvotes }},
hasReplies: {{ whether this comment has replies }},
numberOfReplies: {{ number of replies to the comment }},
replies [
{
{{ ... same fields as comment }}
},
...
],
...
}
]
}
FAQs
Youtube comment API
The npm package youtube-comment-api receives a total of 8 weekly downloads. As such, youtube-comment-api popularity was classified as not popular.
We found that youtube-comment-api demonstrated a not healthy version release cadence and project activity because the last version was released a year ago. It has 1 open source maintainer collaborating on the project.
Did you know?
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.
Research
Security News
Socket’s threat research team has detected six malicious npm packages typosquatting popular libraries to insert SSH backdoors.
Security News
MITRE's 2024 CWE Top 25 highlights critical software vulnerabilities like XSS, SQL Injection, and CSRF, reflecting shifts due to a refined ranking methodology.
Security News
In this segment of the Risky Business podcast, Feross Aboukhadijeh and Patrick Gray discuss the challenges of tracking malware discovered in open source softare.