1.0.3 • Published 7 years ago

little-ytlib v1.0.3

Weekly downloads
3
License
MIT
Repository
github
Last release
7 years ago

Nils little youtube library

For nodejs and every happy browser

The only thing you need is a google api key :) (https://console.developers.google.com/) which is enabled for the YouTube Data API

FAQ

How can I install it ?

For the browser you should use bower (https://bower.io):
bower install little-ytlib --save
In NodeJS yarn (https://yarnpkg.com/lang/en/) or npm (... https://nodejs.org/en/):
Yarn: yarn add little-ytlib
NPM: npm install little-ytlib --save

How can I use it now ?

If you want to use it in your browser, you need to include the bundle.min.js

<script src="bower_components/little-ytlib/bundle.min.js"></script>
<script>
  var yt = new YTLib("MY_API_KEY");
  // Now you can use it
</script>

If you want to use it with NodeJS, simply require it:

const YTLib = require('little-ytlib');
const yt = new YTLib("MY_API_KEY");
// Now you can use it

How do I known which methods I can use ?

I think I doucmented the library very good with JSDoc. You can simply look in the source file on this repository (https://raw.githubusercontent.com/TheNoim/YouTubeLibrary/master/YouTubeLibrary.js)

Documentation

Classes

Typedefs

YouTubeLibrary

Kind: global class
Author: Nils Bergmann nilsbergmann@noim.io

new YouTubeLibrary(APIKey)

Nils little youtube library

ParamDescription
APIKeyAPI Key to access the youtube data api

youTubeLibrary.getVideoInformation(videoId, Callback) ⇒ Promise.<(VideoSnippet|Array.<VideoSnippet>)>

Get the video information's of the videoId

Kind: instance method of YouTubeLibrary

ParamType
videoIdstring | array
Callbackfunction

youTubeLibrary.searchOnYouTube(SearchText, type, Order, maxResults, pages, nextPageToken) ⇒ Promise.<searchListResponse>

Search on youtube with the given parameters

Kind: instance method of YouTubeLibrary

ParamTypeDefaultDescription
SearchTextstring
typestring"video,channel,playlist"
Orderstring"relevance"
maxResultsint20Max result per page
pagesint10how many pages to query
nextPageTokenstring

youTubeLibrary.getPlaylistInformation(playlistId, Callback) ⇒ Promise.<PlaylistInformation>

Get all important information's of a playlist

Kind: instance method of YouTubeLibrary

ParamType
playlistIdstring
Callbackfunction

youTubeLibrary.getPlaylist(playlistId, Callback) ⇒ Promise

Get all information's of a playlist including the videos. The videos are resolved to youtube#video

Kind: instance method of YouTubeLibrary

ParamType
playlistIdstring
Callbackfunction

youTubeLibrary.getPlaylistVideos(playlistId, Callback) ⇒ Promise.<Array>

Get only the resolved videos of a playlist. Videos are in the format youtube#video

Kind: instance method of YouTubeLibrary

ParamType
playlistIdstring
Callbackfunction

youTubeLibrary.getChannelID(forUsername, Callback) ⇒ Promise.<String>

Get the channelId of an username

Kind: instance method of YouTubeLibrary

ParamType
forUsernamestring
Callbackfunction

youTubeLibrary.getChannelPlaylists(channelId, Callback) ⇒ Promise.<Array.<PlayListWithVideos>>

Get all playlist's of a channel. The videos are in the format youtube#video

Kind: instance method of YouTubeLibrary

ParamType
channelIdstring
Callbackfunction

youTubeLibrary.getChannelPlaylistsByUsername(Username, Callback) ⇒ Promise.<Array.<PlayListWithVideos>>

Same as getChannelPlaylists() but you can use the channel username instead of the channel id

Kind: instance method of YouTubeLibrary

ParamType
Usernamestring
Callbackfunction

youTubeLibrary.getChannel(channelID, Callback) ⇒ Promise.<Object>

Get channel information's

Kind: instance method of YouTubeLibrary

ParamType
channelIDstring
Callbackfunction

youTubeLibrary.getChannelByUsername(Username, Callback) ⇒ Promise.<Object>

Same as getChannel() but you can use the channel username instead of the channel id

Kind: instance method of YouTubeLibrary

ParamType
Username
Callbackfunction

YouTubeVideoResource : Object

Kind: global typedef
Properties

NameTypeDescription
kindstringType (youtube#video)
etagstring
idstringVideoId
snippetVideoSnippet
statisticsVideoStatistics

VideoSnippet : Object

Kind: global typedef
Properties

NameTypeDescription
publishedAtstringDate in ISO 8601 format
channelIdstring
titlestringVideo title
descriptionstring
thumbnailsObject
channelTitlestringThe displayname of the channel which published the video
tagsArray.<string>List of tags for the video
categoryIdstringhttps://developers.google.com/youtube/v3/docs/videoCategories/list
liveBroadcastContentstring
defaultLanguagestring
localizedObject
defaultAudioLanguagestring

VideoStatistics : Object

Kind: global typedef
Properties

NameTypeDescription
viewCountint
likeCountint
dislikeCountint
favoriteCountintThis property has been deprecated. The deprecation is effective as of August 28, 2015. The property's value is now always set to 0.
commentCountint

YouTubePageInfo : Object

Kind: global typedef
Properties

NameType
totalResultsint
resultsPerPageint

searchListResponse : Object

Kind: global typedef
Properties

NameType
kindstring
etagstring
nextPageTokenstring
regionCodestring
pageInfoYouTubePageInfo
itemsArray

PlaylistInformation : Object

Kind: global typedef
Properties

NameType
kindstring
etagstring
idid
snippetPlaylistSnippet
contentDetailsPlaylistContentDetails

PlaylistSnippet : Object

Kind: global typedef
Properties

NameTypeDescription
publishedAtstringDate in ISO 8601 format
channelIdstring
titlestring
descriptionstring
thumbnailsObject
channelTitlestringThe displayname of the channel which published the playlist
tagsArray.<string>List of tags for the playlist
defaultLanguagestring
localizedObject

PlaylistContentDetails : Object

Kind: global typedef
Properties

NameTypeDescription
itemCountintThe count how much items the playlist contains

Video : Object

Kind: global typedef
Properties

NameType
kindstring
etagstring
idstring
snippetObject
contentDetailsObject
statisticsObject

PlayListWithVideos : Object

Kind: global typedef
Properties

NameType
kindstring
etagstring
idstring
snippetObject
contentDetailsObject
videosArray.<Video>