我把youtube网址作为用户输入。我的逻辑如下: if(URL === link_to_video)然后获取视频else if( URL == link_to_channel),然后获取all_videos_of_channel。
我是通过JavaScript和使用YouTube API v3来实现这一点的。
问题是,youtube似乎有两种类型的URL到youtube频道。
以上两个链接都将带您到同一个频道,但我当前的上传代码只支持/user/CalvinHarrisVEVO。
有没有办法使这两个网址在获得频道视频方面表现相似?
发布于 2015-06-26 12:14:55
一种解决方案是解析url,然后应用此逻辑:
if there is `channel` in the url link
call the APIv3 with the **id** of the channel
Ressource : youtube.channels.list
else if there is 'user'
call the APIv3 with the **forUsername** of the channel
Ressource : youtube.channels.list检查:https://developers.google.com/apis-explorer/#p/youtube/v3/youtube.channels.list
https://stackoverflow.com/questions/31072280
复制相似问题