Skip to content

ponjdev/youtube-search-api

 
 

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

20 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Youtube Search API

Youtube Search API is an API for getting Youtube search results.

Installation

npm install youtube-search-api

Usage (import)

const youtubesearchapi=require('youtube-search-api');

GetListByKeywords (Promise)

youtubesearchapi.GetListByKeyword("<keywords>",[playlist boolean],[limit number])

GetListByKeywords Result

{items:[],nextPage:{nextPageToken:"xxxxxxxx",nextPageContext:{}}}

"items" is the array from youtube, "nextPage" needs to pass when going to the next page. If playlist arg is true, will return type:'playlist' but the videos:[] property will not return the whole videos in the list, need to call GetPlaylistData to get real playlist's videos. Item with Video type will return isLive=[true/false] to identify live video or not.

NextPage (Promise)

youtubesearchapi.NextPage(<nextPage from GetListByKeywords result>,[playlist boolean],[limit number])

NextPage Result

{items:[],nextPage:{nextPageToken:"xxxxxxxx",nextPageContext:{}}}

Item with Video type will return isLive=[true/false] to identify live video or not.

Playlist with ID (Promise)

youtubesearchapi.GetPlaylistData(<Playlist Id>,[limit number])

Playlist Result

{items:[],metadata:{}}

Get Suggest Data (Promise)

youtubesearchapi.GetSuggestData([limit number])

Suggest Data Result

{items:[]}

Item with Video type will return isLive=[true/false] to identify live video or not.

Get Channel by channel Id (Promise)

youtubesearchapi.GetChannelById(<channel ID>)

Channel Data Results

[
  [ { title: '[title]', content: [Object] } ]
]

Will return tabs in array format.

Message

If you want to work with me to fix bug or implement new idea. You are available to send me some new idea of this project.

Contributing

Pull requests are welcome. For major changes, please open an issue first to discuss what you would like to change.

Please make sure to update tests as appropriate.

TODO

  1. Support front-end (Vue, React) (On going)

Bug fixed

Update

  1. channelTitle add into return items. (by SirBob01) (https://github.com/SirBob01)
  2. Implemented results limit parameter for all functions (by ElyasAsmad) (https://github.com/ElyasAsmad)
  3. async/await implemented

License

MIT

About

Get Youtube Search result without any login or api key

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors

Languages

  • JavaScript 100.0%