How do I retrieve title of a youtube video?

soinno - May 21, 2009 - 06:04
Project:Embedded Media Field
Version:6.x-1.9
Component:Embedded Video Field
Category:feature request
Priority:normal
Assigned:Unassigned
Status:postponed
Description

I would like to be able to retrieve the video title from youtube and display it, how do I do that?

#1

jrefano - November 5, 2009 - 01:16
Version:6.x-1.0» 6.x-1.9

i have the same request. i can display an emvideo in my view no problem, but i want to also display the title of the video (as a field), pulled from youtube. possible?

#2

aaron - November 4, 2009 - 21:36
Status:active» postponed

it's technically possible, though not easy. fyi, the title of the original youtube video is stored in the field's data array, under the raw/'http://www.w3.org/2005/Atom'/TITLE/0 element, so you could display it in your theme, for instance, with

<?php
print check_plain($node->field_video[0]['data']['raw']['http://www.w3.org/2005/Atom']['TITLE'][0]);
?>
.

YouTube, Blip.TV, and possible Archive.org are currently the only providers fetching this data. It might be worth storing and displaying this metadata on a more general level. (The original author, perhaps, as well.) Similar to how we now grab the duration when available.

Patches are welcome.

 
 

Drupal is a registered trademark of Dries Buytaert.