Here’s an NSFW example, the pics in this post:
http://piesaucy.tumblr.com/post/166229190077/h-honey-a-very-nice-and-relaxing-zeppelin (again, NSFW)
I know that both pics are already on Derpibooru, I’m just using it as an example because it’s a post with two PNG pics.
The pic with Night Light,
https://66.media.tumblr.com/0d62f431bb952c3907d895e739caf0c2/tumblr_oxkot6NuK11u2sl0oo2_r1_1280.png
is actually a 310733 byte JPEG, despite the extension, while
https://78.media.tumblr.com/0d62f431bb952c3907d895e739caf0c2/tumblr_oxkot6NuK11u2sl0oo2_r1_1280.png
is a 1233687 byte PNG.
However, with the pic with Shining Armor,
https://78.media.tumblr.com/0fe55cb425dd123cd6fb9d229f3e4df7/tumblr_oxkot6NuK11u2sl0oo1_r1_1280.png
is a 311107 byte JPEG, and you’d need to download
https://68.media.tumblr.com/0fe55cb425dd123cd6fb9d229f3e4df7/tumblr_oxkot6NuK11u2sl0oo1_r1_1280.png
to get a 1258683 byte PNG.
I mean, the numbers before .media.tumblr.com
seem to be completely unrelated to the format of the image served, and it’s the same when using just media.tumblr.com
, without numbers, the server returns randomly JPEGs or PNGs. It seems to be a cache thing, so maybe the links here will even return different images after the cache expires.
At least the images with the wrong format return the appropriate Content-Type: image/jpeg
header, so this behavior is easy to detect programmatically.
I’ve been completely unable to find any query parameter or any header that would force the server to return always a PNG, but I think that the cache at a.tumblr.com
always serves the right format. It uses CloudFront recompression though, for example, the pic with Night Light,
https://a.tumblr.com/0d62f431bb952c3907d895e739caf0c2/tumblr_oxkot6NuK11u2sl0oo2_r1_1280.png
is a 1197225 byte PNG (while Tumblr’s original copy was 1233687 bytes), and the pic with Shining Armor,
https://a.tumblr.com/0fe55cb425dd123cd6fb9d229f3e4df7/tumblr_oxkot6NuK11u2sl0oo1_r1_1280.png
is a 1222339 byte PNG (while Tumblr’s original copy was 1258683 bytes).
Again, I’m not sure if this server will always return the right format, but maybe it’s worth checking the pic returned by this server, in case the first attempt at downloading the image from *.media.tumblr.com
gets a JPEG instead.
After a quick search, I found that there are already some of these JPEGs on Derpibooru, such as >>1841565 (merged), >>1841432, or >>1841383 (merged). They all should be PNGs, media.
serves JPEG versions for them, but a.
serves a PNG.
a.tumblr.com
is that it’s not always accessible (nsfw): @$ curl -kv https://68.media.tumblr.com/3cb69a5025052a5190d611d26640a7a9/tumblr_n8u6mwlw1J1rwimero4_1280.png 1> /dev/null
Trying 77.238.180.14…GET /3cb69a5025052a5190d611d26640a7a9/tumblr_n8u6mwlw1J1rwimero4_1280.png HTTP/1.1
Host: 68.media.tumblr.com
User-Agent: curl/7.57.0
Accept: /< HTTP/1.1 200 OK
< Date: Thu, 04 Oct 2018 23:48:49 GMT
< Content-Type: image/png
< Content-Length: 726715
(…)@
@$ curl -kv https://68.media.tumblr.com/3cb69a5025052a5190d611d26640a7a9/tumblr_n8u6mwlw1J1rwimero4_1280.png 1> /dev/null
Trying 69.147.92.13…GET /3cb69a5025052a5190d611d26640a7a9/tumblr_n8u6mwlw1J1rwimero4_1280.png HTTP/1.1
Host: 68.media.tumblr.com
User-Agent: curl/7.57.0
Accept: /< HTTP/1.1 200 OK
< Date: Thu, 04 Oct 2018 23:36:22 GMT
< Content-Type: image/jpeg
< Content-Length: 272440
(…)@
curl -kv https://77.238.180.14/3cb69a5025052a5190d611d26640a7a9/tumblr_n8u6mwlw1J1rwimero4_1280.png -H "Host: 68.media.tumblr.com" -O
Host
header still determines the file that will be received. For example, this will download the JPEG. curl -kv https://77.238.180.14/3cb69a5025052a5190d611d26640a7a9/tumblr_n8u6mwlw1J1rwimero4_1280.png -H "Host: media.tumblr.com" -O
St
SyaN anywhere, for example).a.tumblr.com
doesn’t always work, but after this I’m giving up, it’s simply not worth it. window\['\_\_\_INITIAL\_STATE\_\_\_'\]\["image-url-page"\].photo
._r1
(“edited” mark) with wrong (lesser?) order id may lead to simply image without wrapper, I don’t have enough samples to research it.Help fund the $15 daily operational cost of Derpibooru - support us financially!