0
votes

I am not able to get the channel's data if the channel name has spaces in it, e.g. Meditation Relax Music.

My API call :

https://www.googleapis.com/youtube/v3/channels?part=statistics&forUsername=Meditation+Relax+Music&key={YOUR_API_KEY}

My approach to get the data is, to remove spaces from the name before calling the API. It is working for some of the channels like Unversal Pictures

Test sample:

 WebClient client = new WebClient();
 dynamic var = client.DownloadString(@"https://www.googleapis.com/youtube/v3/channels?part=statistics&forUsername=Meditation+Relax+Music&key={YOUR_API_KEY}");

Please help!

1
Could you post the relevant code, the lines which declare, initialize, and use the channel name? See How to Ask.mins
Here we go: WebClient client = new WebClient(); dynamic var = client.DownloadString(@"googleapis.com/youtube/v3/…{YOUR_API_KEY}");Mayank

1 Answers

2
votes

Try this, change the forUsername to YourRelaxMusic1, my api call:

GET https://www.googleapis.com/youtube/v3/channels?part=statistics&forUsername=YourRelaxMusic1&key={YOUR_API_KEY}

The channel has a unique representation and this is the id, and the owner of the channel is the YourRelaxMusic1 user in this case. So if you dont have the id of the channel you need to get it through the username.