Drupal oEmbed & Embed.ly module
Recently I have been inspired by this Mustard Seed's video podcast of Bob, and started to develop a custom Drupal 7 module for creating rich article previews and embeded video, images and music from external providers as Youtube, Vimeo, SoundCloud, Twitter, Foursquare, Instagram, Amazon...
You only need the oEmbed Drupal module and the embed.ly service and you will have the same preview article creation than Facebook and Google+ on your Drupal website.
oEmbed allow to format a URL as an embeded representation of it's content. It's useful when you want to make a preview of the link content. The oEmbed format of the following Youtube link is:
Request
http://www.youtube.com/oembed?url=http%3A//youtube.com/watch%3Fv%3DM3r2XDceM6A&format=json
Response
{
"version": "1.0",
"type": "video",
"provider_name": "YouTube",
"provider_url": "http://youtube.com/",
"width": 425,
"height": 344,
"title": "Amazing Nintendo Facts",
"author_name": "ZackScott",
"author_url": "http://www.youtube.com/user/ZackScott",
"html":
"<object width=\"425\" height=\"344\">
<param name=\"movie\" value=\"http://www.youtube.com/v/M3r2XDceM6A&fs=1\"></param>
<param name=\"allowFullScreen\" value=\"true\"></param>
<param name=\"allowscriptaccess\" value=\"always\"></param>
<embed src=\"http://www.youtube.com/v/M3r2XDceM6A&fs=1\"
type=\"application/x-shockwave-flash\" width=\"425\" height=\"344\"
allowscriptaccess=\"always\" allowfullscreen=\"true\"></embed>
</object>",
}
There are a lot of useful fields in the oEmbed response that you could use to create the rich content preview. The oEmbed Core Drupal module has the following function to obtain the response data:
$oembed = oembedcore_oembed_data($url);
In $oembed variable you wil find all the oEmbed response parameters. You could see an example in the Cancamusic Drupal module thats is in my sandbox.
Thanks to the oEmbed Embed.ly module (that comes within the oEmbed module) you can also get oEmbed data from more than 200 providers.
Hope you will find this module as useful as we do. We are using it at our freak audio & videos website: http://cancamusic.com