Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Get title from YouTube videos

Tags:

youtube

I want to extract the Title of YouTube's videos. How can I do this?

Thanks.

like image 716
webkul Avatar asked Aug 01 '09 07:08

webkul


People also ask

What is a YouTube title?

What are YouTube titles? Titles are the names of your YouTube videos and they are mandatory in order to post anything on YouTube. This means that you can't post a YouTube video without a title. They vary in length and are extremely important.


1 Answers

Easiest way to obtain information about a youtube video afaik is to parse the string retrieved from: http://youtube.com/get_video_info?video_id=XXXXXXXX

Using something like PHP's parse_str(), you can obtain a nice array of nearly anything about the video:

$content = file_get_contents("http://youtube.com/get_video_info?video_id=".$id); parse_str($content, $ytarr); echo $ytarr['title']; 

That will print the title for the video using $id as the video's id.

like image 69
Cruel Avatar answered Nov 09 '22 00:11

Cruel