node-yt-search
Version:
Search in YouTube With NodeJS
69 lines (60 loc) • 1.68 kB
Markdown
YouTube Search With NodeJS!
==============
**NPM INSTALL**
To Donwload the dependencies
----------
**Example Usage:**
```javascript
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](https://developers.google.com/youtube/v3/docs/?hl=pt-br)**.
**Credits:** This project was inspired by the following project available in **GitHub** **[MaxGfeller](https://github.com/MaxGfeller/youtube-search)**.