Hello,

as mentionned in https://drupal.org/node/1567240, current Fbsmp's Link plugin support for today's youtube video pages does not retrieve youtube video thumbnail properly, only the user picture and other pics on the page.

An easy way to get such information as video thumbnail from video pages or press articles would be to grab available Open Graph og:image page attributes.

Why not implement such a mechanism within the link plugin or allow third-party modules to plug in ?

Comments

myselfhimself’s picture

Here is a patch that adds a hook named "hook_fbsmp_link_request_contents" for third-party modules URL parsing in place of the link plugin's parsing.

Note that emvideo and emaudio parsers still come first when enabled, and will superse any third-party parsing modules that could plug in with the new hook.

myselfhimself’s picture

Here is an example module implementation for the new hook that adds basic Open Graph (og:*) attributes parsing thanks to the url-scraper-php github project (PHP licence ?, authored by morshedalam).

With this example module: youtube, vimeo and dailymotion video pages, www.lemonde.fr (famous French newspaper website) articles and other famous press sites get parsed correctly (title, description, thumbnail). Google.com and wikipedia.org home pages do not get parsed well still.

Note: I have renamed and deleted files in the example_module archive to remove customer's branding, I have not tested but the code quality should be ok.
Make sure to rename .tar_.gz file to .tar.gz before extracting (d.org security renaming...).

myselfhimself’s picture

myselfhimself’s picture

myselfhimself’s picture

Category: Bug report » Feature request
designguru’s picture

The module set in #3 didn't do anything to help this problem for me...

q./

mr.andrey’s picture

Applied patch in #1 and downloaded/enabled module in #2, YouTube thumbnails now show up. Thanks!

Unfortunately, it breaks other links, like Drupal.org, for example.

The $data array returned is this

array ( 'title' => '', 'description' => '', 'images' => array ( ), )

To fix, I added:

  if ($data['title'] == '') { 
    $data = array(); 
  }

... before

return $data

... so if this custom script can't fetch the title, don't bother returning a non-empty array.

It's still not perfect and needs some development love, but at least it's fetching some images.

Cheers,
A.

keith.penn27’s picture

Hello everyone! I am looking for a solution to this same issue. I have tried the above patch and module but it didn't work for me. Am I missing something that I should have done? I am using Drupal 7.51 and FBSMP 7.x-1.0-alpha1. Please help! I have been working on this for a couple of days now and all I can get for the thumbnail is https://s.ytimg.com/yts/img/pixel-vfl3z5WfW.gif.

ugintl’s picture

There is a module called opengraph filter which you can enable in a text format and it is working perfectly for me, but it does not embed the content. Any solution to embed the content using the link option?