I'm trying to pull some data using the YouTube Data API via Google Apps Script.
This is what I have done so far and it's working without any issue.
var searchParameter = {
q: 'javascript',
maxResults: 50,
type:'videos'
}
var results = YouTube.Search.list('id,snippet', searchParameter);
Now I want add location filter to this query.
According to docs I added location and locationRadius parameters:
var searchParameter = {
q: 'javascript',
maxResults: 50,
type:'videos',
location: "37.42307,-122.08427",
locationRadius: "999km",
}
var results = YouTube.Search.list('id,snippet', searchParameter);
But after adding these 2 parameters, it's not working anymore and I'm getting following error:
{ [GoogleJsonResponseException: API call to youtube.search.list failed with error: Request contains an invalid argument.] details: { errors: [ [Object] ], message: 'Request contains an invalid argument.', code: 400 }, name: 'GoogleJsonResponseException' }.
I'm following this guide:
https://developers.google.com/youtube/v3/docs/search/list#location.
What am I doing wrong here?