Product
Introducing SSO
Streamline your login process and enhance security by enabling Single Sign-On (SSO) on the Socket platform, now available for all customers on the Enterprise plan, supporting 20+ identity providers.
kyle-yt
Advanced tools
Readme
A Node.js package for YouTube API videos.
Install the package using npm:
npm install kyle-yt
const KyleYT = require('kyle-yt');
const kyleYT = new KyleYT();
// Example usage: search for a video
kyleYT.search('The Weeknd - Save Your Tears (Official Music Video)').then(result => {
let video = result.items[0];
console.log('Id: ' + video.id);
console.log('Url: ' + video.url);
console.log('Name: ' + video.name);
console.log('Views: ' + video.views);
}).catch(error => {
console.error('Error:', error);
});
search(query, options)
Searches YouTube for videos based on the given query.
query
: The search query string.options
: An optional object containing search options.
limit
: The maximum number of videos to return (default is 1).Returns a Promise that resolves to an object containing an array of video items. Each video item has a url
property representing the URL of the video.
extractVideoInfo(htmlBody, limit)
Helper function to extract video information from the HTML response.
htmlBody
: The HTML body of the response from YouTube search.limit
: The maximum number of videos to extract.Returns an array of video objects containing their URLs.
const KyleYT = require('kyle-yt');
const kyleYT = new KyleYT();
const videoURL = 'https://www.youtube.com/watch?v=jNQXAC9IVRw';
const filename = 'video.mp4';
kyleYT.download(videoURL, filename)
.then(() => {
console.log('Video downloaded successfully! 🎉');
})
.catch(error => {
console.error('An error occurred while downloading the video:', error);
});
const KyleYT = require('kyle-yt');
const kyleYT = new KyleYT();
kyleYT.search('The Weeknd - Save Your Tears (Official Music Video)').then(result => {
let video = result.items[0];
console.log('Id: ' + video.id);
console.log('Url: ' + video.url);
console.log('Name: ' + video.name);
console.log('Views: ' + video.views);
}).catch(error => {
console.error('Error:', error);
});
FAQs
A Node.js package for YouTube API videos.
The npm package kyle-yt receives a total of 61 weekly downloads. As such, kyle-yt popularity was classified as not popular.
We found that kyle-yt demonstrated a healthy version release cadence and project activity because the last version was released less than 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.
Product
Streamline your login process and enhance security by enabling Single Sign-On (SSO) on the Socket platform, now available for all customers on the Enterprise plan, supporting 20+ identity providers.
Security News
Tea.xyz, a crypto project aimed at rewarding open source contributions, is once again facing backlash due to an influx of spam packages flooding public package registries.
Security News
As cyber threats become more autonomous, AI-powered defenses are crucial for businesses to stay ahead of attackers who can exploit software vulnerabilities at scale.