SO I started using the node.js request module to make request to the youtube api. I could make the query string of the below link myself, but I'm pretty sure there is a shortcut. Does anyone know it?
The youtube API link
'https://www.googleapis.com/youtube/v3/search?part=snippet&q=black%20panther&key=AIzaSyD4shfocwn-Ed3Feuoo9fG3d2K2GjHmKeI&maxResults=20&order=viewCount&type=video'
So, I'm looking for a shortcut to add the above query string to my http request
request('https://www.googleapis.com/youtube/v3/search', function (error, response, body) {
});
You can use querystring in node js just pass a json object with query parameters and it will convert it to query string
const querystring = require('querystring');
const obj = { part: 'snippet', q: 'black' };
const urlQueryString = querystring.stringify(obj);
request('https://www.googleapis.com/youtube/v3/search?' + urlQueryString ,
function (error, response, body) {
});
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With