问题
We've noticed the search results returned from the v3 search api are different depending on the location of the server. I've confirmed the code is exactly the same and when I run a test using the try-it section of the api documentary website on the different server the results are different as well. Does anyone know why?
https://developers.google.com/youtube/v3/docs/search/list#try-it
回答1:
That's normal, just as you'd expect from YouTube's web search, depending on your login and location, it will find most relevant videos.
回答2:
I was having the same problem. In my own computer (I'm in Brazil) the call would return 10 videos. When executed on Azure server (East-US) it would return no videos at all.
So I added the param regionCode=BR
and it worked properly.
回答3:
Though its very old thread, let me share my learning for others who face this.
So to keep api request generic within all servers you need to set few request parameters of youtubeapi.
RegionCode -- region to filter videos for that channel/user.
And sort result if desired.
来源:https://stackoverflow.com/questions/21864967/why-is-the-youtube-api-search-returning-different-results-from-different-servers