youtubeyoutube-apiyoutube-channels

How to get YouTube channel name?


I have searched in YouTube Documents and found nothing to get others channel name from a YouTube video.

That is,

I currently would like to get the channel name from a video, I only have the URL, how to get the channel name?


Solution

  • 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

    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).

    For more information, see Retrieving Data for a Single Video and the rest of the YouTube API documentation.

    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.