如何获得YouTube频道名称? [英] How to get YouTube channel name?
问题描述
我已经搜索了 YouTube文档,但没有找到任何可从YouTube获得其他频道名称的信息视频.
I have searched in YouTube Documents and found nothing to get others channel name from a YouTube video.
也就是说,
我目前想从视频获取频道名称,我只有URL,如何获取频道名称?
I currently would like to get the channel name from a video, I only have the URL, how to get the channel name?
推荐答案
您可以从URL中提取视频ID,然后发出HTTP GET请求:
You can extract the video id from the URL, and then make an HTTP GET request:
https://gdata.youtube.com/feeds/api/videos/dQw4w9WgXcQ?v = 2& alt = json
其中dQw4w9WgXcQ
是您感兴趣的视频ID.它返回JSON响应,并在author
字段中提供频道名称(单击链接以获取示例).
where dQw4w9WgXcQ
is the video id you're interested in. This returns a JSON response, with the channel name in the author
field (click the link for an example).
有关更多信息,请参见检索单个视频的数据以及其他内容. YouTube API文档.
For more information, see Retrieving Data for a Single Video and the rest of the YouTube API documentation.
例如参见如何做我可以使用正则表达式在字符串中找到所有YouTube视频ID吗?以某种方式从YouTube URL获取视频ID.
See e.g. How do I find all YouTube video ids in a string using a regex? for some ways to get the video id from a YouTube URL.
这篇关于如何获得YouTube频道名称?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!