An Asynchronous promise based wrapper around the YouTube Data API.
Open terminal from the project folder execute the following command to install the package :
yarn add youtube-v3-api
--------OR--------
npm install youtube-v3-api
Sample code snippet :
const { YoutubeDataAPI } = require("youtube-v3-api")
const API_KEY = '<ENTER YOUR API KEY HERE>';
const api = new YoutubeDataAPI(API_KEY);
api.searchAll(API_KEY,"Node Js",25).then((data) => {
console.log(data);
},(err) => {
console.error(err);
})
Returns a collection of search results that match the query parameters specified in the API request. By default, a search result set identifies matching video, channel, and playlist resources, but you can also configure queries to only retrieve a specific type of resource.
searchAll(q: string, maxResults: number, args?: any): Promise<{}>
- API_KEY : The youtube API Key. See here to know about how to get an API KEY.
- q : Search query.
- maxResults : The maximum number of search results (0 - 50, for more results check out next and previous page call).
- args (Optional) : Additional parameters, to know more click here.
Returns a list of videos that match the API request parameters.
searchVideo(id: string, args?: any): Promise<{}>
- API_KEY : The youtube API Key. See here to know about how to get an API KEY.
- id : Video Id.
- args (Optional) : Additional parameters, to know more click here.
Returns a collection of zero or more channel resources that match the request criteria.
searchChannel(id: string, args?: any): Promise<{}>
- API_KEY : The youtube API Key. See here to know about how to get an API KEY.
- id : Channel Id.
- args (Optional) : Additional parameters, to know more click here.
Returns a list of videos that match the API request parameters.
searchChannelSections(channelId: string, args?: any): Promise<{}>
- API_KEY : The youtube API Key. See here to know about how to get an API KEY.
- channelId : Channel Id.
- args (Optional) : Additional parameters, to know more click here.
Returns a list of comments that match the API request parameters.
searchComments(parentId: string, args?: any): Promise<{}>
- API_KEY : The youtube API Key. See here to know about how to get an API KEY.
- parentId : The parent comment is the first comment on a video.
- args (Optional) : Additional parameters, to know more click here.
Returns a list of comment threads that match the API request parameters.
searchCommentThreads(videoId: string, args?: any): Promise<{}>
- API_KEY : The youtube API Key. See here to know about how to get an API KEY.
- videoId : Video Id.
- args (Optional) : Additional parameters, to know more click here.
Returns a collection of playlists that match the API request parameters. For example, you can retrieve all playlists that the authenticated user owns, or you can retrieve one or more playlists by their unique IDs.
searchPlaylist(channelId: string, maxResults: number, args?: any): Promise<{}>
- API_KEY : The youtube API Key. See here to know about how to get an API KEY.
- channelId : Channel Id.
- maxResults : The maximum number of search results (0 - 50, for more results check out next and previous page call).
- args (Optional) : Additional parameters, to know more click here.
Returns a collection of playlist items that match the API request parameters. You can retrieve all of the playlist items in a specified playlist or retrieve one or more playlist items by their unique IDs.
searchPlaylistItems(playlistId: string, maxResults: number, args?: any): Promise<{}>
- API_KEY : The youtube API Key. See here to know about how to get an API KEY.
- playlistId : Playlist Id.
- maxResults : The maximum number of search results (0 - 50, for more results check out next and previous page call).
- args (Optional) : Additional parameters, to know more click here.
- Use the default Http module so that this module can be free from dependency.
- Any missing basic API calls.
- next and previous page.
- Make typescript classes for the data returned so that additional functions can be attached like next page and previous page.
- Embed all OAuth2 API's.
- Add the additional API calls which need OAuth2 Access.
NOTE : Everything must Promise
d.