1.1.2 • Published 4 years ago

our-yt-api v1.1.2

Weekly downloads
-
License
ISC
Repository
-
Last release
4 years ago

You look for a simple youtube api? Here is it ;D

Version 1.1.1

You need support or have to mention somethings? Join my discord!

Require the npm's modules

const ytube = require('our-yt-api');

Create params for getting access to yts database

const params = new ytube.Params({

"key": "YOUR-API-KEY"

});

:information_source: the params are used by the module you dont need to access them at this version

Methodes

searching for youtube video

/*
<lib> is your const name of the module require 
*/
<lib>.searchVideo($string, function(err, res) => {

//check if there is an error
if(err) return console.error(err);

//check if there are results
if(res){

/*
this is an example of handling the result!
the result is json and there are a lot of properties you can use..
the properties are shown below
*/

 console.log(res[0].url);

}

});

Properties of searched Video

/*
returns number of results (Int)
range 0-5;
*/
res.length

/*
returns video url (string)
e.g https://www.youtube.com/watch?v=dQw4w9WgXcQ
*/
res[0].url
//res[0].shortURL returns the 'short URL'

/*
returns videos title (string)
*/
res[0].title

/*
returns videos description (string)
*/
res[0].description

/*
returns videos id (string)
e.g dQw4w9WgXcQ
*/
res[0].id

/*
returns the >>default<< thumbnail url (string)
[format == JPG}
*/
res[0].thumbnail

/*
return thumbnail types
-default
-medium
-high
*/
//URL (jpg)
res[0].thumbnails.<type>.url
//width in px
res[0].thumbnails.<type>.width
//height in px
res[0].thumbnails.<type>.height

There will be some updates soon ;)

1.1.2

4 years ago