node-yt-search

0.0.10 • Public • Published

YouTube Search With NodeJS!

NPM INSTALL To Donwload the dependencies


Example Usage:

 const search = require('...');

 const opts = {
   maxResults: 3,
   pageToken: '',
   videoPart: 'snippet,statistics',
   key: 'YOUR TOKEN HERE',
 };
 
 search('Depeche Mode - Enjoy the Silence', opts, (err, results, pageInfo) => {
   if (err) console.log(err);
   console.log(result);
 });

Structure returned.

pageInfo:

{ totalResults: 1000000,
  resultsPerPage: 3,
  nextPageToken: 'CAMQAA',
  prevPageToken: undefined 
}

result:

{ kind: 'youtube#videoListResponse',
  etag: '"VPWTmrH7dFmi4s1RqrK4tLejnRI/dSRKwYvxOzUWdQE9d8dCcaKOwKo"',
  pageInfo: { totalResults: 3, resultsPerPage: 3 },
  items:[
    { 
      kind: 'youtube#video',
      etag: '"VPWTmrH7dFmi4s1RqrK4tLejnRI/bBvOzg1k65HOaje_CGQODgxAvUk"',
      id: 'B_3TlrZLpQ0',
      snippet: [Object],
      contentDetails: [Object] 
    },
    { 
      kind: 'youtube#video',
      etag: '"VPWTmrH7dFmi4s1RqrK4tLejnRI/ZZNwolMVYMjZU8UPTrtOK_ShrM0"',
      id: 'MB37Xobja4w',
      snippet: [Object],
      contentDetails: [Object] 
    },
    { 
      kind: 'youtube#video',
      etag: '"VPWTmrH7dFmi4s1RqrK4tLejnRI/Tz7du2Nt_YphdaHNrY3PwCh2isw"',
      id: 'JlvDXOuBvLo',
      snippet: [Object],
      contentDetails: [Object] 
    }
  ]
}

For more details on the structure returned please visit YouTube API Reference.

Credits: This project was inspired by the following project available in GitHub MaxGfeller.

Package Sidebar

Install

npm i node-yt-search

Weekly Downloads

1

Version

0.0.10

License

ISC

Last publish

Collaborators

  • eduwl