Redirects to high-res images on gallery sites, skipping past descriptions and comments
< Părere la script-ul Eza's Image Glutton
I'm sorry to say I can't guarantee optimal size on DeviantArt. The site is hostile toward this script.
For example: on my machine, that page redirects to the 1280 px wide version. It works in both of my browsers, on GreaseMonkey and TamperMonkey, logged in and logged out. But I'm not surprised it works differently for you. DeviantArt has a dozen different page formats for different images, assigned without comprehensible reason. Their preview and full-quality URL formats are compatible... sometimes. Their download links work for display... sometimes. Their click-to-enlarge URLs are in the HTML... sometimes. They are a very old website embodying everything wrong with the modern web.
Thank you for the bug report. I tried some solutions which are more general. They failed. If this script redirects to a large version of the correct image, that will have to suffice for now.
Just wanted to say that I think I've made an OK image grabber for deviantArt for my script, you could use it if you want
https://github.com/Owyn/HandyImage/blob/master/HandyImage.user.js#L1565
(it seems our userscripts do pretty much the same thing btw)
"OK" is underselling it. You're the Owyn who I made a note about in this source code, like a decade ago. It's still there. (And still has a userscripts.org URL.) The number of sites you support is jawdropping.
Closely referencing how you handle DeviantArt, I've now modified how this script handles DeviantArt. I've simplified it somewhat because the old-image approach also works on click-to-enlarge image URLs.
This response took a while because I kept missing small GIFs. Turns out, so does Handy Image. So for example - https://www.deviantart.com/thecynicalhound/art/Jackson-Journal-Doll-607221470 - displays a broken GIF in Handy Image (on Firefox 91.0.1, ViolentMonkey 2.13.0, Linux Mint 20), and simply fails to redirect in Image Glutton. I'm still trying to figure out a straightforward way to recognize when that's happened, and fall back on my previous method.
I see, small very old (id <= 790677560) gif (or not just gif?) images with download option disabled... that's rather specific...
alike small gif but with dl enabled - works: https://www.deviantart.com/kosperry/art/But-Foxy-543229035
600x600 old png - works: https://www.deviantart.com/mogucho/art/Tamamo-477314551
if only size is the criteria - we could check if there's a zoom-in cursor on the image before trying to get bigger res getComputedStyle(img).cursor === "zoom-in"
I pushed a fix based on this: https://github.com/Owyn/HandyImage/commit/ba3dd887d139ae0fe255e9a8d14ae9a48ad604f7
maybe you have more samples of old small images to test it on?
Once again, sorry for the delay - it turns out I really hate DeviantArt. All of this should now work properly.
The horrible-looking /(\/f\/[^\/]+\/[^\/]+)\// regex finds the "f/something/something/" portion of an old-style image URL. f, slash, non-slashes, slash, non-slashes, slash. It's the right answer, and a straightforward implementation, but it does look bewildering.
DeviantArt - gets not the max available size
https://www.deviantart.com/josephbiwald/art/Destiny-2-Warmind-Secondary-Keyart-804940104
if you click the image normally - you get 1280px version, but script gets only 1192px version