I'm taking a youtube url as user input. The logic I have is as follows: if(URL === link_to_video) then get video else if( URL == link_to_channel) then get all_videos_of_channel.
I am doing this via JavaScript and using the YouTube API v3.
The problem is, it seems youtube has two types of URLs to youtube channels.
- /channel/, eg: www.youtube.com/channel/UCaHNFIob5Ixv74f5on3lvIw
- /user/, eg: www.youtube.com/user/CalvinHarrisVEVO
both the above links will take you to the same channel, but my current uploader code supports only /user/CalvinHarrisVEVO.
is there any way to make both the URLs behave similarly in terms of obtaining the channel videos?
One solution would be to parse the url and then apply this logic:
Check : https://developers.google.com/apis-explorer/#p/youtube/v3/youtube.channels.list