the_lotus
the_lotus

Reputation: 12748

Find country of channel in youtube api v3

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 Location property. It seems like it doesn't exists in v3 of the api.

Since I'm only interested in channels from a specific country, is there a way to know in which country a channel is in?

Upvotes: 8

Views: 13608

Answers (6)

Davide Bassi
Davide Bassi

Reputation: 1

Yes, you can access a channel's country in API v3 through the snippet.country property.

Make a request to:

GET https://www.googleapis.com/youtube/v3/channels?part=snippet&id={CHANNEL_ID}&key={YOUR_API_KEY}

Check the snippet.country field in the response for the channel's country code. Note that this field may not be available for all channels, as it depends on whether the channel owner has set their country in their channel settings.

Upvotes: 0

Tanuj Sharma
Tanuj Sharma

Reputation: 11

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!

Upvotes: 1

Matteo G.P. Flora
Matteo G.P. Flora

Reputation: 21

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.

Upvotes: 2

daesu
daesu

Reputation: 620

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.

Upvotes: 1

Ibrahim Ulukaya
Ibrahim Ulukaya

Reputation: 12877

The only workaround is using guideCategories.

You can list guideCategories by region.

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

Upvotes: 2

Millie Smith
Millie Smith

Reputation: 4604

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

Upvotes: 0

Related Questions