Why is the YouTube api search returning different results from different servers?

ぐ巨炮叔叔 提交于 2021-01-27 15:58:07

问题


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

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!