I know that I can get all the information about the video using:
http://gdata.youtube.com/feeds/api/videos/ID
but this outputs a lot of information, and im uses a regular expression to get the name from it. I was wondering if there is a way for this page to display only the title, and not all other materials that I donโt need.
Not sure if this will help as I have never worked with youtube api before. I just looked at this information yesterday. According to http://dl.google.com/googleio/2010/googleapis-how-google-builds-apis.pdf you can do Partial Get (just search this pdf for โPartial answerโ) with fields=entry(title) (although I think it is for video search). By requesting the actual video ID instead of a string, it will return only one video.
fields=entry(title)
Example:
http://gdata.youtube.com/feeds/api/videos?v=2&q=[video_id]&max-results=1&fields=entry(title)&prettyprint=true
<? $id = 'VIDEOID'; $xmlData = simplexml_load_string(file_get_contents("http://gdata.youtube.com/feeds/api/videos/{$id}?fields=title")); $title = (string)$xmlData->title; echo $title;
http://gdata.youtube.com/feeds/api/videos/[ID]? = Header Fields
experimental, but working.
It returns an XML file, so use simpleXML to parse it.
Prefix search term with "title:", for example:
http://gdata.youtube.com/feeds/base/videos?q=title:<search term>