My Opera Development

Behind the scenes at My Opera

Embedding My Opera content (OEmbed)

, , ,

Now you can embed photos and other My Opera content like avatars from external sites. It's been on our roadmap for some time.

We chose to embrace the OEmbed (www.oembed.com) "specification" for doing that.

OEmbed it's really simple. It uses JSON (or XML) as an interchange format, and the request and response types are really simple and straightforward. An OEmbed request has the following structure:

http://my.opera.com/service/oembed?url=<some_url>&format=json

The format is json by default and can be omitted, so a sample request to get information about MyOpera photo album looks like:

http://my.opera.com/service/oembed/?url=http%3A%2F%2Fmy.opera.com%2Fcstrep%2Falbums%2Fshow.dml?id%3D504322

This is one of my photo albums. The result is the following:

{
  "author_name" : "cstrep",
  "provider" : "My Opera Community",
  "images" : {
      "image" : [
        "http://my.opera.com/cstrep/albums/showpic.dml?album=504322&picture=6964560",
        "http://my.opera.com/cstrep/albums/showpic.dml?album=504322&picture=6964559",
        "http://my.opera.com/cstrep/albums/showpic.dml?album=504322&picture=6964556",
        "http://my.opera.com/cstrep/albums/showpic.dml?album=504322&picture=6964558",
        "http://my.opera.com/cstrep/albums/showpic.dml?album=504322&picture=6964531",
        "http://my.opera.com/cstrep/albums/showpic.dml?album=504322&picture=6964554",
        "http://my.opera.com/cstrep/albums/showpic.dml?album=504322&picture=6964557",
        "http://my.opera.com/cstrep/albums/showpic.dml?album=504322&picture=6964555"
      ]
  },
  "author_url" : "http://my.opera.com/cstrep/",
  "provider_url" : "http://my.opera.com/",
  "version" : "1.0",
  "type" : "link",
  "title" : "Italian Day"
}

Note: if you have problems displaying the JSON code and you're faced with a download instead, try to instruct your browser to open application/json mimetype directly. In Opera, just go to the Tools menu, Preferences. Click on the Advanced tab, then Downloads on the left. You can see all the special mimetypes. Now click on Add, and insert the application/json mimetype and tell Opera to open it directly.

You can also recursively request information about a single picture, using:

http://my.opera.com/service/oembed?url=http%3A%2F%2Fmy.opera.com%2Fcstrep%2Falbums%2Fshowpic.dml%3Falbum%3D504322%26picture%3D6964560

The result is:

{
  "width" : "2080",
  "author_name" : "cstrep",
  "provider" : "My Opera Community",
  "author_url" : "http://my.opera.com/cstrep/",
  "provider_url" : "http://my.opera.com/",
  "version" : "1.0",
  "height" : "1544",
  "url" : "http://files.myopera.com/cstrep/albums/504322/100_2450.jpg",
  "title" : "Giardinelli Beach. Sardinia.",
  "type" : "photo"
}

So, there you have it, the filename of the picture, finally...

The base implementation for this OEmbed functionality is completely generic and open. Then we have a bunch of different plugins, like Photo, Avatar, Album, and so on... And it's really easy to add new ones.

We're now planning to use this API internally for new features already planned. Hopefully also widgets.opera.com will use OEmbed internally to access avatar pictures. Here's an example:

http://my.opera.com/service/oembed?url=http%3A%2F%2Fmy.opera.com%2Fcstrep%2Favatar.pl

If you prefer the xml format instead, you can append the format=xml argument to the URL, like in the following example:

http://my.opera.com/service/oembed?format=xml&url=http%3A%2F%2Fmy.opera.com%2Fcstrep%2Favatar.pl

Of course, not everything is accessible to any user. Private albums will remain private. Anyway, the main point of OEmbed is being able to share content, so... have fun.

Latest batch of changes...Santa Coxy sent gifts to the team

Comments

Tamil Wednesday, December 3, 2008 10:23:19 AM

cool

Шуйский Николай [krigstask, Ŝtérkrìg]Sterkrig Wednesday, December 3, 2008 10:42:27 AM

Looks nifty, thanks (-:E

P.S. Tamil is everywhere!

DavidSchalandra Wednesday, December 3, 2008 1:40:00 PM

Great! up
Will try that in my xmas holidays. wizard

mrmass Wednesday, December 3, 2008 7:33:03 PM

Wow, what a hideous Windows theme!

jonpar Thursday, December 4, 2008 1:39:43 AM

...only i don't think i will...ever spend/have the time to apply that sad

Dan Alexandrudantesoft Thursday, December 4, 2008 7:00:28 AM

May I suggest you also report the thumbnail URL, it's very useful. (I vaguely remember fred/ saying there are a couple of sizes for those)

I'm not happy to notice the service has the same bug as my widget: for group photos, the URL assumes the wrong username for the album owner.
E.g. http://my.opera.com/365/albums/showpic.dml?album=649265&picture=8862030
Photo URL: http://files.myopera.com/vpalmeira/albums/649265/08%2012%2003.jpg
OEmbed: http://my.opera.com/service/oembed/?url=http%3A//my.opera.com/365/albums/showpic.dml%3Falbum%3D649265%26picture%3D8862030


"author_name" : "vpalmeira",
"author_url" : "http://my.opera.com/vpalmeira/",
"url" : "http://files.myopera.com/365/albums/649265/08 12 03.jpg",
...



But this should be easy to fix.

Cosimo Strepponecstrep Thursday, December 4, 2008 9:27:24 AM

@dantesoft: yes, it is easy to fix. Filed internally as #2556.

Dustin WilsonKhadgar Thursday, December 4, 2008 3:08:23 PM

Awesome! Damn you all for giving me more work! DAMN YOU! Now I have to implement My Opera avatars using this method on my site!

But thanks! I'm a glutton for punishment!

Khadra Warsame Penh Neangkhadwar_neang_666 Friday, December 5, 2008 12:00:43 AM

cool wonderful great .... already embedding contents from myopera account to other websites .... so how hard can it be to do embedding from a outside sources to myopera account other ways around ....
MAY YOU HAVE MANY MORE .... Here is the embedding code that I'm using .... < img src="http://img.mocospace.com.edgesuite.net/user/images/3134/orig/photoalbum_31334908_user9400946-1.jpg""" />
MAY YOU HAVE MANY MORE .... The image are set to private at the place thats hosting the image ....

Charles SchlossChas4 Friday, December 12, 2008 5:38:56 PM

P.S. Tamil is everywhere!




I am not sure I have seen a blog without a post by Tamil

OEmbed looks like fun

DesertDawg Thursday, December 18, 2008 12:12:12 PM

Not Found

The requested URL /desertdawg/albums/633531/P2.jpg was not found on this server.

Dan Alexandrudantesoft Saturday, February 14, 2009 7:49:48 AM

When you fix #2556 make sure you leave the feature whereby you can ask for an album number regardless of its author smile Makes for a useful random photo feature.

May I suggest you also report the thumbnail URL

That's actually not needed, the 320 x 240 pics are obtained by splicing /thumbs and _thumb.jpg in the photo URL.

Cosimo Strepponecstrep Saturday, February 14, 2009 8:30:52 PM

I'm happy to say that #2556 is already fixed. Will be live **SOON**...
About the thumbnail URL, I think your suggestion was really appropriate, since we might want to change/move the tn URLs.

You don't want to rely on the current URL scheme...

We don't want too :-)

Dan Alexandrudantesoft Friday, March 6, 2009 6:18:01 AM

#2556 is still active.

As a suggestion, could the other MyO services be listed on http://my.opera.com/community/api/ ? I'm thinking of the RDFs' and feeds' technical details. Some words about the XMLs available for widgets.opera.com, too.

Cosimo Strepponecstrep Friday, March 6, 2009 4:32:34 PM

@dantesoft: we're planning that, yes...

Pavel Pavlovskijhoollis Wednesday, August 11, 2010 7:05:17 PM

parade,super,thank

Write a comment

You must be logged in to write a comment. If you're not a registered member, please sign up.