Open thelastfantasy opened 7 years ago
(function() {
"use strict";
try {
var ogI = responseText.match(/<meta property="og:image" content="(.+?)"/i);
var type = responseText.match(/<meta property="og:type" content="(?:.+?:)?(.+?)"/i)[1];
var obj = responseText.match(/\t?({".+?)<\/script>/i);
//var obj = responseText.match(/<script.*?type=\"application\/ld\\+json\">(.+?)<\/script>/i);
var url = null;
var name = null;
if(!!obj && !!obj[1]) {
obj = JSON.parse(obj[1].replace(/\n/g,"\\n"));
//obj = JSON.parse(obj[1]);
var obT = typeof obj.image;
if(obT === "string") {
queueDownload(obj.image);
} else if(obT === "object") {
for(var i of obj.image["@list"]) {
queueDownload(i);
}
}
if(type === "video") {
name = "tumblr_" + ogI[1].match(/\/tumblr_([a-zA-Z0-9]+)_frame/)[1];
url = "https://www.tumblr.com/video_file/" +
baseURL.match(/\/post\/([0-9]+)/)[1] + "/" + name;
name = name + ".mp4";
} else {
throw new Error("Media not located in object.");
}
} else if(!!ogI && !!ogI[1]) {
url = ogI[1];
} else {
throw new Error("Media not located in page.");
}
setURL(url, name);
} catch(e) {
log(e.message);
} finally {
finish();
}
})();
My fix.
As I mentioned in #130 the issue was that new lines were added which were not accounted in my original code, and my fix in the issue post takes care of that.
Hi, I have the same problem... tried updating with the new code above, but didn't work... the "post" plugin is not downloading all pictures from the post, only the first one. Can this be fixed?
Now it can only grab the first image of the post.