Skip to content

Commit

Permalink
Support archived.moe (fixes #1253)
Browse files Browse the repository at this point in the history
  • Loading branch information
qsniyg committed Jan 9, 2024
1 parent 7a85c80 commit 05a2a3d
Show file tree
Hide file tree
Showing 2 changed files with 164 additions and 44 deletions.
67 changes: 66 additions & 1 deletion src/userscript.ts
Original file line number Diff line number Diff line change
Expand Up @@ -40417,6 +40417,8 @@ var $$IMU_EXPORT$$;
// https://img.fireden.net/v/thumb/1473/86/1473865883091s.jpg
// https://img.fireden.net/v/image/1462/89/1462892637456.gif
domain === "img.fireden.net" ||
// https://img-lb.fireden.net/cm/thumb/1704/66/1704667072520561s.jp
domain === "img-lb.fireden.net" ||
// https://torako.wakarimasen.moe/file/torako/mu/thumb/1607/77/1607774036400s.jpg
// https://torako.wakarimasen.moe/file/torako/mu/image/1607/77/1607774036400.jpg
domain === "torako.wakarimasen.moe" ||
Expand All @@ -40438,9 +40440,22 @@ var $$IMU_EXPORT$$;
domain_nowww === "archiveofsins.com") {
// http://img.4plebs.org/boards/hr/thumb/1526/06/1526064949904s.jpg
// http://img.4plebs.org/boards/hr/image/1526/06/1526064949904.jpg
let baseobj = {};
if (domain_nowww === "thebarchive.com" ||
domain_nowww === "archiveofsins.com") {
baseobj = {
headers: {
Referer: "https://" + domain + "/"
}
};
}

newsrc = src.replace(/\/thumb(\/+[0-9]{4}\/+[0-9]{2}\/+[0-9]+)s(\.[^/.]*)(?:[?#].*)?$/, "/image$1$2");
if (newsrc !== src)
return add_full_extensions(newsrc);
return fillobj_urls(add_full_extensions(newsrc), baseobj);

baseobj.url = src;
return baseobj;
}

if (domain === "arch.b4k.co") {
Expand Down Expand Up @@ -110695,6 +110710,56 @@ var $$IMU_EXPORT$$;
return src.replace(/(\/photos\/+.\/+.\/+[^/]+\/+[0-9]+\/+)t_/, "$1");
}

if (domain_nowww === "archived.moe") {
// thanks to vscum on github: https://github.com/qsniyg/maxurl/issues/1253

const archive_map = {
// https://archived.moe/files/b/thumb/1704/81/1704817981404742s.jpg
"b": "thebarchive",
// https://archived.moe/files/bant/thumb/1704/66/1704665929725547s.jpg
"bant": "thebarchive",
// https://archived.moe/files/cm/thumb/1704/66/1704667072520561s.jpg
"cm": "fireden",
"h": "archiveofsins",
"hc": "archiveofsins",
"hm": "archiveofsins",
"i": "archiveofsins",
"lgbt": "archiveofsins",
"r": "archiveofsins",
"s": "archiveofsins",
"soc": "archiveofsins",
"t": "archiveofsins",
"u": "archiveofsins",
"y": "fireden"
};

match = src.match(/\/files\/+([^/]+)\/+thumb\/+[0-9]+\/+[0-9]+\/+([0-9]+)s\./);
if (match) {
let board = match[1];
let picid = match[2];
let picid_4 = picid.match(/^([0-9]{4})/)[1];
let picid_2 = picid.match(/^[0-9]{4}([0-9]{2})/)[1];

let urls = [];

if (board in archive_map) {
let provider = archive_map[board];

if (provider === "thebarchive") {
urls.push("https://thebarchive.com/data/" + board + "/thumb/" + picid_4 + "/" + picid_2 + "/" + picid + "s.jpg")
} else if (provider === "fireden") {
urls.push("https://img-lb.fireden.net/" + board + "/thumb/" + picid_4 + "/" + picid_2 + "/" + picid + "s.jpg")
} else if (provider === "archiveofsins") {
urls.push("https://archiveofsins.com/data/" + board + "/thumb/" + picid_4 + "/" + picid_2 + "/" + picid + "s.jpg")
}
}

urls.push("https://i.4cdn.org/" + board + "/" + picid + "s.jpg");

return urls;
}
}




Expand Down
Loading

0 comments on commit 05a2a3d

Please sign in to comment.