youtube-api-v3-search
Version:
Searching YouTube with the YouTube Data API v3
19 lines (17 loc) • 409 B
JavaScript
const https = require('https');
module.exports = function(url){
return new Promise(( resolve ,reject )=>{
https.get(url,
(res) => {
let data = '';
res.on('data', (chunk) => {
data += chunk;
});
res.on('end', () => {
resolve(JSON.parse(data));
});
}).on('error', (err) => {
reject(JSON.parse(err));
});
});
}