Showing
1 changed file
with
20 additions
and
0 deletions
youtube.js
0 → 100644
| 1 | +var response = 'IU'; | ||
| 2 | + | ||
| 3 | +var request = require("request"); | ||
| 4 | + | ||
| 5 | +var options = { method: 'GET', | ||
| 6 | + url: 'https://www.googleapis.com/youtube/v3/search', | ||
| 7 | + qs: | ||
| 8 | + { key: 'AIzaSyA8-HR7V5cGIwWiBUWzKZsm5yzwrYc-4ys', | ||
| 9 | + part: 'snippet', | ||
| 10 | + maxResults: '1', | ||
| 11 | + order: 'viewCount', | ||
| 12 | + q: response, | ||
| 13 | + type: 'video' }, | ||
| 14 | + }; | ||
| 15 | + | ||
| 16 | +request(options, function (error, response, body) { | ||
| 17 | + if (error) throw new Error(error); | ||
| 18 | + | ||
| 19 | + console.log(body); | ||
| 20 | +}); | ||
| ... | \ No newline at end of file | ... | \ No newline at end of file |
-
Please register or login to post a comment