Im using the Media module to embed youtube videos. Id like like to use this module to make the node title be the title of the video according to youtube.

If I create a view and show the embedded file field it outputs the title according to youtube correctly. I have this field as a token for title generation but when I try and use it the title is left blank.

Im not sure, but im assuming this is because the youtube title isnt stored by drupal. Is there a way to access it eg with PHP? The Automatic Nodetitles module has the same issue but ive posted here as this seems the more advanced module.

Comments

bforchhammer’s picture

Title: Cant use embedded youtube's video title? » Get youtube's video title in php?
Project: Automatic Entity Label » Media: YouTube
Version: 7.x-1.2 » 7.x-2.x-dev

If it's not stored in the database, then I assume that there is a function for generating it, yes. Let's see if anyone in the Media:Youtube issue queue can tell you which one it is...

stefan.r’s picture

The youtube title is stored as the filename of the file object (field "filename" in the file_managed table) in MediaInternetYouTubeHandler::getFileObject(), so the PHP code for this would be:


  $file_object = file_uri_to_object($uri, TRUE);
  $title = check_plain($file_object->filename);
Devin Carlson’s picture

Status: Active » Fixed

This is fixed per #2.

Status: Fixed » Closed (fixed)

Automatically closed - issue fixed for 2 weeks with no activity.