glowing-bear icon indicating copy to clipboard operation
glowing-bear copied to clipboard

Integrate imgur album viewer

Open cormier opened this issue 11 years ago • 5 comments

See reddit for example

cormier avatar Oct 04 '13 13:10 cormier

That's a bit tricky.

For a given single image ID (let's use 2YZA3CP here), we can have many URLs like:

http://imgur.com/gallery/2YZA3CP
http://imgur.com/2YZA3CP

With the following form, only the image is displayed (this should be handled by the generic image plugin):

http://i.imgur.com/2YZA3CP.png
http://i.imgur.com/2YZA3CP.gif
http://i.imgur.com/2YZA3CP.jpg
http://i.imgur.com/2YZA3CP.jpeg
http://imgur.com/2YZA3CP.png
http://imgur.com/2YZA3CP.gif
http://imgur.com/2YZA3CP.jpg
http://imgur.com/2YZA3CP.jpeg

But for a gallery ID (e.g. 8E66G), with have those URLs:

http://imgur.com/gallery/8E66G
http://imgur.com/a/8E66G
http://imgur.com/a/8E66G/all
http://imgur.com/a/8E66G/embed
http://imgur.com/a/8E66G/embed#0
...

vivien avatar Oct 17 '13 21:10 vivien

This seems like a good place to leverage the imgur api. It would require registering a client account for access, would you be interested in building this into glowing-bear?

urandom2 avatar Sep 26 '15 18:09 urandom2

Bump. I'm just going to include what I've sad on IRC so that I don't have to retype everything.

<─> Tuesday (May 23) <Techman> 03:29:05 AM <+lorenzh> It's issue #10, Techman :D <Techman> Does Imgur not already have some sweet sweet embed code available on their website? <Techman> Maybe take notes from https://github.com/honestbleeps/Reddit-Enhancement-Suite/blob/master/lib/modules/hosts/imgur.js ? <Techman> RES seems to handle it pretty well so that might be worth taking a look at <Techman> Well actually, it doesn't seem too difficult at all <Techman> I'm not a regex kind of person so I can't help with matching, but it appears to be basically something like this: <Techman> <blockquote class="imgur-embed-pub" lang="en" data-id="a/ALBUM_ID"><a href="//imgur.com/ALBUM_ID">ALBUM_TITLE</blockquote><script async src="//s.imgur.com/min/embed.js" charset="utf-8"></script> <Techman> I'm not sure if you need to load the script more than once, but I'd hope that you don't <Techman> So that way you just generate that HTML <blockquote> with the proper stuff in it, inject it into the HTML, and the script should turn it into the proper embed. <Techman> Of course, I think some people have already thought of this and they have seen something that I haven't seen, but so far this looks to be simple.

Techman avatar May 23 '17 05:05 Techman

Might be worth looking at this again now since imgur behavior has changed since this issue was posted in 2013 because a lot of single image URLS are now located at the imgur.com domain rather than i.imgur.com. These types of URLs can be single images or albums, and currently do not get the embedded treatment in glowing bear at all.

More current guidance about parsing can be gleaned from a Chrome/Firefox extension called Imagus. It shows images inline and has a parser for imgur (among many other websites) that includes all variations of urls about imgur.

azizLIGHT avatar Mar 24 '19 21:03 azizLIGHT

If this is still of actuality, I can try to do something.

Edit: currently working on it.

ghost avatar Mar 14 '20 22:03 ghost