Resolving two types of YouTube channel URLs in API v3 -


i'm taking youtube url user input. logic have follows: if(url === link_to_video) video else if( url == link_to_channel) all_videos_of_channel.

i doing via javascript , using youtube api v3.

the problem is, seems youtube has 2 types of urls youtube channels.

  • /channel/, eg: www.youtube.com/channel/ucahnfiob5ixv74f5on3lviw
  • /user/, eg: www.youtube.com/user/calvinharrisvevo

both above links take same channel, current uploader code supports /user/calvinharrisvevo.

is there way make both urls behave in terms of obtaining channel videos?

one solution parse url , apply logic:

if there `channel` in url link     call apiv3 **id** of channel     ressource : youtube.channels.list else if there 'user'     call apiv3 **forusername** of channel     ressource : youtube.channels.list 

check : https://developers.google.com/apis-explorer/#p/youtube/v3/youtube.channels.list


Comments

Popular posts from this blog

python - No exponential form of the z-axis in matplotlib-3D-plots -

php - Best Light server (Linux + Web server + Database) for Raspberry Pi -

c# - "Newtonsoft.Json.JsonSerializationException unable to find constructor to use for types" error when deserializing class -