simple-youtube-api
Advanced tools
Comparing version 5.1.1 to 5.2.0
const YouTube = require('simple-youtube-api'); | ||
const youtube = new YouTube(' Y o u r A p i K e y '); | ||
youtube.videoById('https://www.youtube.com/watch?v=3odIdmuFfEY') | ||
youtube.getVideo('https://www.youtube.com/watch?v=3odIdmuFfEY') | ||
.then(video => { | ||
console.log(`The video's title is ${video[0].title}`); | ||
console.log(`The video's title is ${video.title}`); | ||
}) | ||
.catch(console.log); |
{ | ||
"name": "simple-youtube-api", | ||
"version": "5.1.1", | ||
"version": "5.2.0", | ||
"description": "A module to simplify the YouTube API.", | ||
"author": "Bryan Pikaard <hypercoder@typicalbot.com>", | ||
"maintainers": [ | ||
"Tyler Richards <rocket0191@gmail.com>" | ||
], | ||
"license": "MIT", | ||
"repository": { | ||
"type": "git", | ||
"url": "https://github.com/simple-youtube/simple-youtube-api.git" | ||
}, | ||
"bugs": { | ||
"url": "https://github.com/simple-youtube/simple-youtube-api/issues" | ||
}, | ||
"homepage": "https://github.com/simple-youtube/simple-youtube-api", | ||
"sideEffects": false, | ||
@@ -9,32 +22,19 @@ "main": "src/index.js", | ||
"scripts": { | ||
"build": "webpack", | ||
"docs": "jsdoc -c jsdoc.json", | ||
"test": "mocha", | ||
"build": "webpack" | ||
"test": "mocha" | ||
}, | ||
"dependencies": { | ||
"iso8601-duration": "^1.0.0", | ||
"node-fetch": "^2.2.1" | ||
"iso8601-duration": "^1.2.0", | ||
"node-fetch": "^2.6.0" | ||
}, | ||
"devDependencies": { | ||
"dotenv": "^4.0.0", | ||
"jsdoc": "^3.4.0", | ||
"jsdoc": "^3.6.2", | ||
"lodash.defaultsdeep": "^4.6.0", | ||
"minami": "^1.1.0", | ||
"mocha": "^3.5.3", | ||
"webpack": "^4.25.1", | ||
"webpack-cli": "^3.1.2" | ||
}, | ||
"repository": { | ||
"type": "git", | ||
"url": "https://github.com/HyperCoder2975/simple-youtube-api.git" | ||
}, | ||
"author": "Hyper-Coder", | ||
"maintainers": [ | ||
"Will Nelson <will@pleb.xyz>" | ||
], | ||
"license": "MIT", | ||
"bugs": { | ||
"url": "https://github.com/HyperCoder2975/simple-youtube-api/issues" | ||
}, | ||
"homepage": "https://github.com/HyperCoder2975/simple-youtube-api" | ||
"webpack": "^4.33.0", | ||
"webpack-cli": "^3.3.4" | ||
} | ||
} |
@@ -1,14 +0,22 @@ | ||
# Simple YouTube API | ||
# Simple YouTube API [](https://discord.gg/A97Qftr) [](https://travis-ci.org/simple-youtube/simple-youtube-api) | ||
[](https://discord.gg/A97Qftr) | ||
[](https://travis-ci.org/HyperCoder2975/simple-youtube-api) | ||
A simpler way to interact with the YouTube Data API. | ||
This library is designed to greatly simplify interacting with the basic functions of the YouTube API. | ||
It deals with viewing/searching videos, playlists, and channels. | ||
## Install | ||
## Installation | ||
$ npm install simple-youtube-api | ||
``` | ||
$ npm install simple-youtube-api | ||
``` | ||
## Usage | ||
- [Documentation](https://HyperCoder2975.github.io/simple-youtube-api/master/) | ||
- [Examples](https://github.com/HyperCoder2975/simple-youtube-api/tree/master/examples) | ||
- [Documentation](https://simple-youtube.github.io/simple-youtube-api/master/) | ||
- [Examples](https://github.com/simple-youtube/simple-youtube-api/tree/master/examples) | ||
## Maintainers | ||
- [Tyler Richards](https://github.com/tjrgg) | ||
## License | ||
[MIT License](LICENSE). |
@@ -51,4 +51,5 @@ const Request = require('./Request'); | ||
* API.getVideo('https://www.youtube.com/watch?v=dQw4w9WgXcQ') | ||
* .then(results => { | ||
* console.log(`The video's title is ${results[0].title}`); | ||
* .then(video => { | ||
* if (video) console.log(`The video's title is ${video.title}`); | ||
* else console.log('video not found :('); | ||
* }) | ||
@@ -70,4 +71,5 @@ * .catch(console.error); | ||
* API.getVideoByID('3odIdmuFfEY') | ||
* .then(results => { | ||
* console.log(`The video's title is ${results[0].title}`); | ||
* .then(video => { | ||
* if (video) console.log(`The video's title is ${video.title}`); | ||
* else console.log('video not found :('); | ||
* }) | ||
@@ -87,4 +89,5 @@ * .catch(console.error); | ||
* API.getPlaylist('https://www.youtube.com/playlist?list=PLuY9odN8x9puRuCxiddyRzJ3F5jR-Gun9') | ||
* .then(results => { | ||
* console.log(`The playlist's title is ${results[0].title}`); | ||
* .then(playlist => { | ||
* if (playlist) console.log(`The playlist's title is ${playlist.title}`); | ||
* else console.log('playlist not found :('); | ||
* }) | ||
@@ -106,4 +109,5 @@ * .catch(console.error); | ||
* API.getPlaylistByID('PL2BN1Zd8U_MsyMeK8r9Vdv1lnQGtoJaSa') | ||
* .then(results => { | ||
* console.log(`The playlist's title is ${results[0].title}`); | ||
* .then(playlist => { | ||
* if (playlist) console.log(`The playlist's title is ${playlist.title}`); | ||
* else console.log('playlist not found :('); | ||
* }) | ||
@@ -123,4 +127,5 @@ * .catch(console.error); | ||
* API.getChannel('https://www.youtube.com/channel/UC477Kvszl9JivqOxN1dFgPQ') | ||
* .then(results => { | ||
* console.log(`The channel's title is ${results[0].title}`); | ||
* .then(channel => { | ||
* if (channel) console.log(`The channel's title is ${channel.title}`); | ||
* else console.log('channel not found :('); | ||
* }) | ||
@@ -142,4 +147,5 @@ * .catch(console.error); | ||
* API.getChannelByID('UC477Kvszl9JivqOxN1dFgPQ') | ||
* .then(results => { | ||
* console.log(`The channel's title is ${results[0].title}`); | ||
* .then(channel => { | ||
* if (channel) console.log(`The channel's title is ${channel.title}`); | ||
* else console.log('channel not found :('); | ||
* }) | ||
@@ -146,0 +152,0 @@ * .catch(console.error); |
@@ -0,0 +0,0 @@ const duration = require('iso8601-duration'); |
@@ -13,3 +13,4 @@ const { parse } = require('url'); | ||
case 'youtube.com': | ||
case 'm.youtube.com': { | ||
case 'm.youtube.com': | ||
case 'music.youtube.com': { | ||
const idRegex = /^[a-zA-Z0-9-_]+$/; | ||
@@ -28,2 +29,6 @@ if (parsed.pathname === '/watch') { | ||
return { channel: id }; | ||
} else if (parsed.pathname.startsWith('/browse/')) { | ||
const id = parsed.pathname.replace('/browse/', ''); | ||
if (!idRegex.test(id)) return {}; | ||
return { channel: id }; | ||
} | ||
@@ -30,0 +35,0 @@ |
Sorry, the diff of this file is not supported yet
New author
Supply chain riskA new npm collaborator published a version of the package for the first time. New collaborators are usually benign additions to a project, but do indicate a change to the security surface area of a package.
Found 1 instance in 1 package
23
35432
14
887
2
Updatediso8601-duration@^1.2.0
Updatednode-fetch@^2.6.0