plsignore said:
Fucking tumblr I swear...

FA completely destroys original upload initially, patreon is upscaling content, twitter uses really high compression values.

Yeah, could be worse.


Thanks to @plsignore or whoever discovered data.tumblr.com.

I noticed that I had to add a security certificate exception (Firefox) to load the image.


I wrote a regular expression with two capture groups for any scripters out there who want to use this to quick replace the "78.media" and "_[numbers].jpeg" parts

/http(?:s)://(\d*.media).tumblr.com/[a-z0-9]*/tumblr_[A-z0-9]*_([0-9]*).jpg/g


To-mos said:
I wrote a regular expression with two capture groups for any scripters out there who want to use this to quick replace the "78.media" and "_[numbers].jpeg" parts

/http(?:s)://(\d*.media).tumblr.com/[a-z0-9]*/tumblr_[A-z0-9]*_([0-9]*).jpg/g

Here is mine:

(https?://)?([0-9]{1,2}.)?(media.tumblr.com/.*)1280.(jpg|png)

result[1]+result[3]+"raw."+result[4]

Will have to change if we have to use data.tumblr.com from now on.


plsignore said:
The new workaround appears to be changing 'media' to 'data'
e.g.

https://media.tumblr.com/229d86359d9e7da34196e9939b270e48/tumblr_oxhlpu0dFA1vjc3oio1_raw.png

gives me a 404, but

https://data.tumblr.com/229d86359d9e7da34196e9939b270e48/tumblr_oxhlpu0dFA1vjc3oio1_raw.png

works.

Fucking tumblr I swear...

oh my god, thank you
I've been trying to figure this out for at least 40 minutes by prodding around with a bunch of url's. data in the domain seems to fix everything! :0


I ended up with /^(https?://)(?:\d+.)?media.tumblr.com(/[0-9a-f]{32}/tumblr_(?:inline_)?[0-9A-Za-z]{16,21}_)\d+(?:\w)?(.[a-z]+)$/i for mine, and a replacement pattern of match[1] + "s3.amazonaws.com/data.tumblr.com" + match[2] + "raw" + match[3]

It accounts for variable length image id sections, inlines, media vs numbers.media and the occasional height or width limited image that have h or w after the dimension.


KiraNoot said:
I ended up with /^(https?://)(?:\d+.)?media.tumblr.com(/[0-9a-f]{32}/tumblr_(?:inline_)?[0-9A-Za-z]{16,21}_)\d+(?:\w)?(.[a-z]+)$/i for mine, and a replacement pattern of match[1] + "s3.amazonaws.com/data.tumblr.com" + match[2] + "raw" + match[3]

It accounts for variable length image id sections, inlines, media vs numbers.media and the occasional height or width limited image that have h or w after the dimension.

This probably isn't the place to ask and I can understand if you don't care to answer, however what would this look like as, let's say, a tampermonkey script? You know, for those of us who don't code but at least know how to add scripts to something like tampermonkey?


AnotherDay said:
This probably isn't the place to ask and I can understand if you don't care to answer, however what would this look like as, let's say, a tampermonkey script? You know, for those of us who don't code but at least know how to add scripts to something like tampermonkey?

I modified an extension that somebody posted in another thread. https://greasyfork.org/scripts/31873-use-tumblr-raw-image/code/Use%20Tumblr%20Raw%20Image.user.js

// ==UserScript==
// @name        Use Tumblr Raw Image
// @namespace   UseTumblrRawImage
// @description Changes all Tumblr hosted images to use the raw version
// @author      jcunews
// @version     1.0.3
// @include     http://*.tumblr.com/*
// @include     https://*.tumblr.com/*
// @grant       none
// @run-at      document-start(
// ==/UserScript==
(function() {
  var regex = /^(https?://)(?:\d+.)?media.tumblr.com(/[0-9a-f]{32}/tumblr_(?:inline_)?[0-9A-Za-z]{16,20}_)\d+(?:\w)?(.[a-z]+)$/i;
  function processSrc(ele) {
    if (!ele.src || (ele.tagName !== "IMG")) return;
    var match = ele.src.match(regex);
    if (!match) return;
    match = match[1] + "s3.amazonaws.com/data.tumblr.com" + match[2] + "raw" + match[3];
    if (ele.getAttribute("data-src") === ele.src) ele.setAttribute("data-src", match);
    ele.src = match;
    ele.style = "max-width: 100%";
  }
  function processContainer(container) {
    var eles = container.querySelectorAll('img[src*=".media.tumblr.com/"]');
    processSrc(container);
    Array.prototype.slice.call(eles).forEach(processSrc);
  }
  var observer = new MutationObserver(function(records) {
    records.forEach(function(record) {
      if (record.attributeName) {
        if (record.attributeName === "src") processSrc(record.target);
      } else {
        var nodes = Array.prototype.slice.call(record.addedNodes);
        nodes.forEach(function(node) {
          if (node.nodeType === 1) processContainer(node);
        });
      }
    });
  });
  addEventListener("load", function() {
    processContainer(document.body);
    observer.observe(document.body, {
      childList: true,
      attributes: true,
      subtree: true
    });
  });
})();