javascriptgoogle-apps-scriptyoutube-apiyoutube-data-apiyoutube-javascript-api

regionCode not working consistently properly, YouTube API, Google App Script


Extracting some data from YouTube API using Google Apps Script, in multiple regions using the following code:

var regions = ['SA','EG','DZ','IQ','JO','KW','LB','LY','MA','OM','YE','AE','BH','QA','TN']; //EG, LY, YE, do not work!
  
sr = YouTube.Videos.list("snippet,id", {chart: "mostPopular", regionCode: regions[i], maxResults:50});

Works properly in all mentioned regions array, except EG , LY and YE, while only changing the regionCode variable.

The code is ISO 3166-1 alpha-2, I am sure the country code is correct. Is there anything I might be missing?

EDIT --- I have re-submitted the issue on Issue Tracker, and it has been assigned.

EDIT -- "This is known issue. Unfortunately, we don't have ETA for the fix."


Solution

  • This appears to be a bug!

    There is already a report on Google's Issue Tracker which detail the same kind of behaviour:

    You can hit the ☆ next to the issue number in the top left on the aforementioned page which lets Google know more people are encountering this and so it is more likely to be seen to faster.