Find country of channel in youtube api v3

前端 未结 5 734
萌比男神i
萌比男神i 2020-12-20 16:24

In v2 of the youtube api, I could get the country of a channel by getting it\'s user information (https://gdata.youtube.com/feeds/api/users/userId) and looking at the Locati

相关标签:
5条回答
  • 2020-12-20 16:57

    The only workaround is using guideCategories.

    You can list guideCategories by region.

    Then in your channels->list call you can plug that category ids.

    0 讨论(0)
  • 2020-12-20 17:08

    The regionCode parameter DOES NOT do what you're thinking :)
    It just sends back videos that ARE AVAILABLE in that country, not the one PUBLISHED in the country.

    0 讨论(0)
  • 2020-12-20 17:09

    It appears V2 of the API has finally been shut down.

    Has anyone managed to come up with a workaround for this since V3 of the API does not support it ?

    I have read through the API docs and while there does appear to be fields available for this data (snippet.country) it doesn't seem to be populated in the vast majority of channels.

    What I require is to find the general region (country) that the channel / Video is associated with. Nothing more fine grained than that.

    0 讨论(0)
  • 2020-12-20 17:16

    As this answer suggests, do a Search: list and filter by region code.

    0 讨论(0)
  • 2020-12-20 17:18

    If you want to know country info of a channel where it is located , it can be get via channel list API by using following code you can get a channel's country if it has mentioned in its ABOUT Section . id = 'Enter_your_channel_id_here' url = 'https://www.googleapis.com/youtube/v3/channels?part=snippet,statistics&id=' + str(id) channel_url = url + '&key=' + str(key) raw_json = requests.get(channel_url).text dataa = json.loads(raw_json) channel_country = dataa['items'][0]['snippet']['country']

    this code will return country code of a specific channel, and by doing some google research you can obtain country names easily for country code. Thanks!

    0 讨论(0)
提交回复
热议问题