Skip to content

Instantly share code, notes, and snippets.

@johndrinkwater
Last active August 29, 2015 13:56
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save johndrinkwater/9254519 to your computer and use it in GitHub Desktop.
Save johndrinkwater/9254519 to your computer and use it in GitHub Desktop.
Imgur’s faulty oembed behaviour
john@joran ~/code/hydden-tools git:master #%❯ ./embed.py http://imgur.com/gallery/afnTUMC
OEmbed cache enabled, location ./cache/oembed/
No cache for http://imgur.com/gallery/afnTUMC
Writing out http://imgur.com/gallery/afnTUMC to cache file ./cache/oembed/300bd84b2845eff04b80d7193a7f9d1ad16f85098f2a295adaf1f3ee2d0ab696
http://imgur.com/gallery/afnTUMC → MRW I am the new lego movie at http://i.imgur.com/afnTUMC.gif
{u'author_name': u'IStealGIFSFromReddit',
u'author_url': u'http://imgur.com/user/IStealGIFSFromReddit',
u'height': 336,
u'provider_name': u'Imgur',
u'provider_url': u'http://imgur.com',
u'sourceurl': 'http://imgur.com/gallery/afnTUMC',
u'title': u'MRW I am the new lego movie',
u'type': u'photo',
u'url': u'http://i.imgur.com/afnTUMC.gif',
u'version': u'1.0',
u'width': 640}
john@joran ~/code/hydden-tools git:master #%❯ ./embed.py http://imgur.com/gallery/CMYNy
OEmbed cache enabled, location ./cache/oembed/
No cache for http://imgur.com/gallery/CMYNy
Writing out http://imgur.com/gallery/CMYNy to cache file ./cache/oembed/dc03f932fe8ff770d919148fa03e994f73f5019775ac4330bf5e9d2c2689aa03
http://imgur.com/gallery/CMYNy → None at None
{u'author_name': u'EmRebJac',
u'author_url': u'http://imgur.com/user/EmRebJac',
u'height': 550,
u'html': u'<iframe class="imgur-album" width="650" height="550" frameborder="0" src="http://imgur.com/a/CMYNy/embed"></iframe>',
u'provider_name': u'Imgur',
u'provider_url': u'http://imgur.com',
u'sourceurl': 'http://imgur.com/gallery/CMYNy',
u'type': u'rich',
u'version': u'1.0',
u'width': 650}
john@joran ~/code/hydden-tools git:master #%❯ ./embed.py http://imgur.com/a/CMYNy?gallery
OEmbed cache enabled, location ./cache/oembed/
No cache for http://imgur.com/a/CMYNy?gallery
Writing out http://imgur.com/a/CMYNy?gallery to cache file ./cache/oembed/a787765074fcbcf34173969d27237789232c828d322f45865c4ad19f3b18efff
http://imgur.com/a/CMYNy?gallery → None at None
{u'height': 550,
u'html': u'<iframe class="imgur-album" width="650" height="550" frameborder="0" src="http://imgur.com/a/CMYNy/embed"></iframe>',
u'provider_name': u'Imgur',
u'provider_url': u'http://imgur.com',
u'sourceurl': 'http://imgur.com/a/CMYNy?gallery',
u'type': u'rich',
u'version': u'1.0',
u'width': 650}
Gallery with one image → returns url
Gallery with one+ images → returns iframe
Gallery with a different URL → returns without author info (which is _THE REVERSE_ to the site, the /a/ link has author details, /gallery/ one doesn’t!)
sidebar: while you’re welcome to move to type:rich for multiple images, including a thumbnail and a title would be _awesome_
john@joran ~/code/hydden-tools git:master #%❯ ./embed.py http://imgur.com/gallery/4GI9jq4
OEmbed cache enabled, location ./cache/oembed/
No cache for http://imgur.com/gallery/4GI9jq4
Writing out http://imgur.com/gallery/4GI9jq4 to cache file ./cache/oembed/79d38c0bc5f0f62263fcc276a3602f663f30903f76f53367509647f491f9ba9b
http://imgur.com/gallery/4GI9jq4 → at http://i.imgur.com/6UziP.jpg
{u'height': 2272,
u'provider_name': u'Imgur',
u'provider_url': u'http://imgur.com',
u'sourceurl': 'http://imgur.com/gallery/4GI9jq4',
u'title': u'',
u'type': u'photo',
u'url': u'http://i.imgur.com/6UziP.jpg',
u'version': u'1.0',
u'width': 1280}
missing title?! should be: u'title': u'Driver's Licence Photo, Level: Redneck'
john@joran ~/code/hydden-tools git:master #%❯ ./embed.py http://imgur.com/r/Eyebleach/e50BHgn
OEmbed cache enabled, location ./cache/oembed/
No cache for http://imgur.com/r/Eyebleach/e50BHgn
Writing out http://imgur.com/r/Eyebleach/e50BHgn to cache file ./cache/oembed/f8bd9f672f5bb39462bd70d49ebd655a49827193bc6f3ef093253d98e0b178dc
http://imgur.com/r/Eyebleach/e50BHgn → at http://i.imgur.com/6UziP.jpg
{u'height': 2272,
u'provider_name': u'Imgur',
u'provider_url': u'http://imgur.com',
u'sourceurl': 'http://imgur.com/r/Eyebleach/e50BHgn',
u'title': u'',
u'type': u'photo',
u'url': u'http://i.imgur.com/6UziP.jpg',
u'version': u'1.0',
u'width': 1280}
john@joran ~/code/hydden-tools git:master #%❯ ./embed.py http://imgur.com/e50BHgn
OEmbed cache enabled, location ./cache/oembed/
No cache for http://imgur.com/e50BHgn
Writing out http://imgur.com/e50BHgn to cache file ./cache/oembed/2652e5f552738c2154d7f8b556c6fc90e7a07303a1ee86f57a751eae4e6dbbf2
http://imgur.com/e50BHgn → at http://i.imgur.com/e50BHgn.jpg
{u'height': 960,
u'provider_name': u'Imgur',
u'provider_url': u'http://imgur.com',
u'sourceurl': 'http://imgur.com/e50BHgn',
u'title': u'',
u'type': u'photo',
u'url': u'http://i.imgur.com/e50BHgn.jpg',
u'version': u'1.0',
u'width': 908}
Doesn’t cope at all with /r/ URLs
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment