Comparing version 2.0.0 to 2.0.1
29
index.js
@@ -35,31 +35,2 @@ const BASE_URL = 'http://mrbaro-youtube-api.glitch.me'; | ||
async getVideoInfo(value, callback) { | ||
let videos, err; | ||
if (callback) { | ||
videos = await fetch(`${BASE_URL}/videos`, { | ||
method: 'POST', | ||
headers: { 'Content-Type': 'application/json' }, | ||
body: JSON.stringify({ | ||
v: value | ||
}) | ||
}) | ||
.then(res => res.json()); | ||
if (videos.error) err = new Error(`BaroTube: ${videos.error}`); | ||
return callback(err, videos[0]); | ||
} else { | ||
videos = await fetch(`${BASE_URL}/videos`, { | ||
method: 'POST', | ||
headers: { 'Content-Type': 'application/json' }, | ||
body: JSON.stringify({ | ||
v: value | ||
}) | ||
}) | ||
.then(res => res.json()); | ||
if (videos.error) throw new Error(`BaroTube: ${videos.error}`); | ||
return videos[0]; | ||
} | ||
} | ||
async getPlaylist(value, callback) { | ||
@@ -66,0 +37,0 @@ let playlist, err; |
{ | ||
"name": "barotube", | ||
"version": "2.0.0", | ||
"version": "2.0.1", | ||
"main": "index.js", | ||
@@ -5,0 +5,0 @@ "scripts": { |
@@ -57,26 +57,2 @@ # barotube | ||
### **.getVideoInfo();** | ||
```js | ||
barotube.getVideoInfo('URL', function(err, data) { | ||
if (err) throw err; | ||
console.log(data); | ||
}); | ||
``` | ||
* Results | ||
>```js | ||
>{ | ||
> title: '', | ||
> videoId: '', | ||
> url: '', | ||
> duration: '', | ||
> durationMs: 0, | ||
> views: 0, | ||
> author: { | ||
> name: '', | ||
> url: '' | ||
> }, | ||
> thumbnail: '' | ||
>} | ||
>``` | ||
### **.getPlaylist();** | ||
@@ -83,0 +59,0 @@ ```js |
4
3788
56
98