Closed Hakkin closed 9 years ago
I can reproduce this, eg from this reddit link: http://www.reddit.com/r/pcmasterrace/comments/2i4uvx/so_i_built_a_1500_wall_mounted_led_lit_gaming_pc/
The problem happens because the page has only 11 og:image meta tags.
We might be able to solve it by calling into the Imgur API instead of parsing its web page. That would require writing the code to do it, registering for an Imgur client ID, and having Imgur approve TZP for white-listing to be exempt from its normal rate-limiting (I don't know whether they'd grant that). See https://api.imgur.com/#limits
I've been looking at how the different imgur layouts display images, it looks like if you parse the "/layout/horizontal" page (eg: http://imgur.com/a/bDIdw/layout/horizontal), it actually has links to all the images in the album.
You would probably have to add imgur set exclusive regex and checking to pages.js though.
Something like /<img id="thumb-([A-Za-z0-9]{5,7})" class="unloaded/g
seems to work to get the image ID, then you would probably have to add a check somewhere after that to turn the ID into a correct link (which shouldn't be hard).
You could also parse the "data-src" of the images, but they're all thumbnail size, so you should have to strip the "s" from them.
I imagine this would to easier to do than implementing the imgur API.
I've got a fix for /a/ galleries (I think). If I add /all to the end, the page it produce has tags for all the images. I can parse for those instead of meta tags, and get all 19 images.
It doesn't work reliably for /gallery/ links though. In some cases like the one below I can change /gallery/ to /a/, and add /all, and it works: http://imgur.com/gallery/T9Vr1
But in this case (a one-pic /gallery/) using /a/ gives an error page. http://imgur.com/gallery/CXxOgqm
I just saw your second comment... so that's basically what I'm doing, except using /all instead of /layout/horizontal.
Unfortunately, I don't think this is fixed. In this album, there is 575 images, but only 56 show up. It looks like the regex you're using is parsing the images that are pre-loaded onto the page (which is apparently 56 on the /all page), instead you should be parsing the elements in the embedded carousel (which can also be accessed directly from the /embed URL on albums, I just found out). I think the regex you're using now would actually work correctly if you just changed "src" to "data-src".
Thanks for the data-src suggestion; that does seem to work. The fixed fix will be in 3.2beta2.
For example, http://imgur.com/a/bDIdw This album has 19 images, but if I mouse over it, it says "1 of 11" I'm assuming this has to do with the main imgur album page only showing a limited number of pictures, then allowing you to click "load more" to get the rest of the album, but I'm not 100% sure. If this is the problem,
it looks like appending "?gallery" to the imgur album URLs forces it to load a page with all the images, instead of just 10-11.(Nevermind, this "fix" doesn't seem to work reliably)