YouTube channel IDs

1,000 views
Skip to first unread message

Peter

unread,
Apr 4, 2017, 5:29:58 PM4/4/17
to Google Civic Information API
Hi,

I'm linking to social media profiles by appending each of the social media channel IDs to a fixed link, but it seems as though the YouTube channel IDs are inconsistent from representative to representative. 

While some IDs are the actual YouTube channel IDs (e.g. Gov. Wolf of PA - UC8cXXCdLzcYoYGa_BqaPsgA), some are actually the channel names instead (e.g. whitehouse). 

Accounts with custom URLs can use either:


Then there's older YT accounts with usernames which uses either:


However, if they don't have a channel name, they cannot use the either of the two links above and they can only be linked via:


Unless there's some sort of catch-all URL for linking to a channel regardless of ID or channel name (searched but couldn't find a catch-all solution), would it be possible to modify the data so that only the raw YT channel IDs are used?

 

Cong Chen

unread,
Apr 5, 2017, 9:29:07 AM4/5/17
to Google Civic Information API
Hi Peter,

Currently the API output wouldn't allow you to differentiate between a youtube channel id, channel name or user name. You research looks quite comprehensive about how to construct the URL under different circumstances though:
  1. For user name or channel name, you can simply implement the URL as youtube.com/{id-provided-by-the-api}
  2. Otherwise (channel-id), the URL will need to have '/channel' in it (youtube.com/channel/{id-provided-by-the-api})
Will you be able to construct URL accordingly by testing out the http response? e.g. if #1 returns a 404, construct the URL as #2. I'm not sure if there is an easier way to make the determination, for example by parsing the value itself if there is a specific length/format of the youtube channel-id. Other forum users who have done similar things in the past can probably share their experiences.

Thanks,
Cong

--
You received this message because you are subscribed to the Google Groups "Google Civic Information API" group.
To unsubscribe from this group and stop receiving emails from it, send an email to google-civicinfo-api+unsub...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.



--

Cong Chen | Partner Technology Manager | cong...@google.com | 212-565-8800

This email may be confidential or privileged. If you received this communication by mistake, please don't forward it to anyone else, please erase all copies and attachments, and please let me know that it went to the wrong person. Thanks. 

Peter

unread,
Apr 6, 2017, 7:29:17 PM4/6/17
to Google Civic Information API
Hey Cong,

After doing some more digging, it looks like all youtube channel IDs start with "UC" plus the account ID. Even Jawed's account has a "UC" channel ID - UC4QobU6STFB0P71PMvOGN5A

I think for now I will be checking the ID string for "UC" within the first 2 characters and then checking to see if the ID string length is equal to 24 characters in case there are any false positives though most Congressional YT accounts at least follow a naming convention. Also I checked a number of other YT accounts and all the channel IDs I looked at were 24 characters in length including Jawed's. 

Cong Chen

unread,
Apr 7, 2017, 10:15:23 AM4/7/17
to Google Civic Information API
Great. Thanks Peter and glad that you now have a workable solution!

To unsubscribe from this group and stop receiving emails from it, send an email to google-civicinfo-api+unsubscrib...@googlegroups.com.

For more options, visit https://groups.google.com/d/optout.



--

Cong Chen | Partner Technology Manager | cong...@google.com | 212-565-8800

This email may be confidential or privileged. If you received this communication by mistake, please don't forward it to anyone else, please erase all copies and attachments, and please let me know that it went to the wrong person. Thanks. 

--
You received this message because you are subscribed to the Google Groups "Google Civic Information API" group.
To unsubscribe from this group and stop receiving emails from it, send an email to google-civicinfo-api+unsub...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.
Reply all
Reply to author
Forward
0 new messages