From 05a2a3dbc216a181003e4fffa6358382a751d639 Mon Sep 17 00:00:00 2001 From: qsniyg Date: Tue, 9 Jan 2024 22:51:42 +0000 Subject: [PATCH] Support archived.moe (fixes #1253) --- src/userscript.ts | 67 ++++++++++++++++++++- userscript.user.js | 141 +++++++++++++++++++++++++++++++-------------- 2 files changed, 164 insertions(+), 44 deletions(-) diff --git a/src/userscript.ts b/src/userscript.ts index c6d87061..cf90b624 100644 --- a/src/userscript.ts +++ b/src/userscript.ts @@ -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" || @@ -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") { @@ -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; + } + } + diff --git a/userscript.user.js b/userscript.user.js index 9de4abb3..cdcdd378 100644 --- a/userscript.user.js +++ b/userscript.user.js @@ -36937,6 +36937,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" || @@ -36958,9 +36960,20 @@ 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 + var baseobj_1 = {}; + if (domain_nowww === "thebarchive.com" || + domain_nowww === "archiveofsins.com") { + baseobj_1 = { + 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_1); + baseobj_1.url = src; + return baseobj_1; } if (domain === "arch.b4k.co") { // https://arch.b4k.co/files/jp/thumb/1578/68/1578682104565s.jpg @@ -42907,25 +42920,25 @@ var $$IMU_EXPORT$$; } } if ((domain_nosub === "muscdn.com" || domain_nosub === "tiktokcdn.com") && /^v[0-9]+m?\./.test(domain)) { - var baseobj_1 = { + var baseobj_2 = { url: src, video: true, can_head: false // 503 sometimes }; - common_functions["set_tiktok_vid_filename"](baseobj_1); + common_functions["set_tiktok_vid_filename"](baseobj_2); if (options.do_request && options.cb && options.rule_specific && options.rule_specific.tiktok_no_watermarks) { common_functions["get_best_tiktok_url"](api_cache, options.do_request, src, function(newurl) { if (newurl) { - baseobj_1.url = newurl; + baseobj_2.url = newurl; } - common_functions["set_tiktok_vid_filename"](baseobj_1); - options.cb(baseobj_1); + common_functions["set_tiktok_vid_filename"](baseobj_2); + options.cb(baseobj_2); }); return { waiting: true }; } else { - return baseobj_1; + return baseobj_2; } } if ((domain_nosub === "pstatp.com" || @@ -49628,13 +49641,13 @@ var $$IMU_EXPORT$$; // https://media2.giphy.com/media/ZBg5XWrvDVzNe/200_s.gif // private gif: // https://i.giphy.com/media/gHPsfv5TM792hQdBRH/giphy.webp - var baseobj_2 = { + var baseobj_3 = { url: src, headers: { Referer: "https://giphy.com/" } }; - obj = baseobj_2; + obj = baseobj_3; match = src.match(/\/media\/+([^/]{10,})\/+/); if (match) { var get_giphy_page = function(id) { @@ -49642,7 +49655,7 @@ var $$IMU_EXPORT$$; }; id = match[1]; var page = get_giphy_page(id); - baseobj_2.extra = { page: page }; + baseobj_3.extra = { page: page }; var query_giphy = function(id, cb) { var cache_key = "giphy:" + id; api_cache.fetch(cache_key, cb, function(done) { @@ -49682,7 +49695,7 @@ var $$IMU_EXPORT$$; } var images = data.images; var get_image = function(obj) { - var ourobj = deepcopy(baseobj_2); + var ourobj = deepcopy(baseobj_3); ourobj.url = obj.url; return ourobj; }; @@ -60936,7 +60949,7 @@ var $$IMU_EXPORT$$; // thanks to vscum on github: https://github.com/qsniyg/maxurl/pull/1147/files // https://cdn.eroticbeauties.net/content/metart_20160107202957_blake-bartelli-mointa-by-charles-lightfoot/auto/3/tn@2x/01.webp // https://cdn.eroticbeauties.net/content/metart_20160107202957_blake-bartelli-mointa-by-charles-lightfoot/full/01.jpg - var baseobj_3 = { + var baseobj_4 = { headers: { Referer: "http://" + domain_nosub + "/" }, @@ -60946,13 +60959,13 @@ var $$IMU_EXPORT$$; }; newsrc = src.replace(/\.webp([?#].*)?$/, ".jpg$1"); if (newsrc !== src) { - baseobj_3.url = newsrc; - return baseobj_3; + baseobj_4.url = newsrc; + return baseobj_4; } newsrc = src.replace(/(\/content\/+[^/]*\/+)(?:[^/]*\/+[^/]*\/+)?(?:tn@[^/]*|[0-9]+|main)\/+((?:[^/.]+_)?[0-9]+\.[^/.]*)$/, "$1full/$2"); if (newsrc !== src) { - baseobj_3.url = newsrc; - return baseobj_3; + baseobj_4.url = newsrc; + return baseobj_4; } } if (domain_nowww === "barahla.net") { @@ -61920,11 +61933,11 @@ var $$IMU_EXPORT$$; }, src ]; - var baseobj_4 = {}; + var baseobj_5 = {}; var match = src.match(/\/([0-9]+)-[^/]+\.[^/.]+(?:[?#].*)?$/); if (match) { id = match[1]; - baseobj_4.extra = { + baseobj_5.extra = { page: "https://www.123rf.com/photo_" + id + ".html" }; if (options.do_request && options.cb) { @@ -61932,25 +61945,25 @@ var $$IMU_EXPORT$$; url: "https://www.123rf.com/photo_" + id + ".html", }, function(data) { if (data) { - baseobj_4 = data; + baseobj_5 = data; } - return options.cb(fillobj_urls(urls, baseobj_4)); + return options.cb(fillobj_urls(urls, baseobj_5)); }, function(done, resp, cache_key) { var match = resp.responseText.match(/dataLayer\.push\({[\s\S]+?["']product_name["']:\s*["'](.*?)["'],/); - baseobj_4.extra.page = resp.finalUrl; + baseobj_5.extra.page = resp.finalUrl; if (match) { - baseobj_4.extra.caption = match[1]; + baseobj_5.extra.caption = match[1]; } else { console_warn(cache_key, "Unable to find match in", resp); } - done(baseobj_4, 24 * 60 * 60); + done(baseobj_5, 24 * 60 * 60); }); return { waiting: true }; } } - return fillobj_urls(urls, baseobj_4); + return fillobj_urls(urls, baseobj_5); } } if (domain_nowww === "chenderroad.com") { @@ -66308,7 +66321,7 @@ var $$IMU_EXPORT$$; domain.match(/^[sb][0-9]*\./)) { // http://s10.trafficdeposit.com/blog/vid/57d2f694dd228/5a4114fc9056e/small.jpg // http://s10.trafficdeposit.com/blog/vid/57d2f694dd228/5a4114fc9056e/full.jpg - var baseobj_5 = { + var baseobj_6 = { url: src, extra: {} }; @@ -66318,9 +66331,9 @@ var $$IMU_EXPORT$$; match = src.match(/^[a-z]+:\/\/[^/]+\/+blog\/+(?:[0-9]+\/+[0-9]+\/+)?(?:vid|img)\/+(?:[0-9a-f]+|porn-collection)\/+([0-9a-f]{10,})\/+[^/]+$/); if (match) { id = match[1]; - baseobj_5.extra.page = "https://sxyprn.com/post/" + id + ".html"; + baseobj_6.extra.page = "https://sxyprn.com/post/" + id + ".html"; urls.push({ - url: baseobj_5.extra.page, + url: baseobj_6.extra.page, is_pagelink: true }); } @@ -66329,7 +66342,7 @@ var $$IMU_EXPORT$$; urls.push(newsrc); } urls.push(src); - return fillobj_urls(urls, baseobj_5); + return fillobj_urls(urls, baseobj_6); } if (domain_nosub === "sxyprn.com") { match = src.match(/^[a-z]+:\/\/[^/]+\/+post\/+([0-9a-f]{10,})\.html/); @@ -81109,10 +81122,10 @@ var $$IMU_EXPORT$$; regex = /(\/live\/+cover_images\/+.*_)([0-9]+x[0-9]+)(\.[^/.]+)(?:[?#].*)?$/; match = src.match(regex); if (match) { - var baseobj_6 = { url: src }; + var baseobj_7 = { url: src }; var idmatch = src.match(/\/live\/+cover_images\/+[^/]+\/+([^/_]{5,15})_/); if (idmatch) { - baseobj_6.extra = { page: "https://www.bitchute.com/video/" + idmatch[1] + "/" }; + baseobj_7.extra = { page: "https://www.bitchute.com/video/" + idmatch[1] + "/" }; } var sizes = [ "1280x720", @@ -81127,14 +81140,14 @@ var $$IMU_EXPORT$$; var newurls = []; array_foreach(sizes, function(size) { if (urlsize < sizetoint(size)) { - var obj = deepcopy(baseobj_6); + var obj = deepcopy(baseobj_7); obj.url = src.replace(regex, "$1" + size + "$3"); newurls.push(obj); } }); - if (idmatch && baseobj_6.extra && baseobj_6.extra.page) { + if (idmatch && baseobj_7.extra && baseobj_7.extra.page) { newurls.unshift({ - url: baseobj_6.extra.page, + url: baseobj_7.extra.page, is_pagelink: true }); } @@ -81143,8 +81156,8 @@ var $$IMU_EXPORT$$; } var videourl = src.replace(/^[a-z]+:\/\/static-([0-9])\.bitchute\.com\/+live\/+cover_images\/+([^/]+\/+[^/_]{5,15})_[0-9]+x[0-9]+\..*/, "https://seed$100.bitchute.com/$2.mp4"); if (videourl !== src) { - baseobj_6.url = videourl; - return baseobj_6; + baseobj_7.url = videourl; + return baseobj_7; } } } @@ -86394,14 +86407,14 @@ var $$IMU_EXPORT$$; } } if (id) { - var baseobj_7 = { + var baseobj_8 = { url: src, extra: { page: "https://www.streamable.com/" + id } }; if (page_nullobj) - page_nullobj.extra = baseobj_7.extra; + page_nullobj.extra = baseobj_8.extra; var query_streamable = function(id, cb) { api_query("streamable:" + id, { url: "https://www.streamable.com/" + id @@ -86414,7 +86427,7 @@ var $$IMU_EXPORT$$; var json = JSON_parse(match[1]); var title = json.title || json.reddit_title; if (title) { - baseobj_7.extra.caption = title; + baseobj_8.extra.caption = title; } var urls = []; if (json.files) { @@ -86463,20 +86476,20 @@ var $$IMU_EXPORT$$; if (options.cb && options.do_request) { query_streamable(id, function(obj) { if (!obj) { - return options.cb(page_nullobj || baseobj_7); + return options.cb(page_nullobj || baseobj_8); } if (!is_array(obj)) { obj = [obj]; } if (page_nullobj) obj.push(page_nullobj); - return options.cb(fillobj_urls(obj, baseobj_7)); + return options.cb(fillobj_urls(obj, baseobj_8)); }); return { waiting: true }; } else { - return page_nullobj || baseobj_7; + return page_nullobj || baseobj_8; } } } @@ -88220,12 +88233,12 @@ var $$IMU_EXPORT$$; var urls = []; array_extend(urls, objs.watermark); array_extend(urls, objs.smaller); - var baseobj_8 = { + var baseobj_9 = { extra: { page: "https://www.imago-images.de/st/" + match[1] } }; - return fillobj_urls(urls, baseobj_8); + return fillobj_urls(urls, baseobj_9); } } if (domain_nowww === "banned.video" || @@ -99343,6 +99356,48 @@ var $$IMU_EXPORT$$; // https://fapopedia.net/photos/s/k/skillsawww/1000//0369.jpg 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 + var 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) { + var board = match[1]; + var picid = match[2]; + var picid_4 = picid.match(/^([0-9]{4})/)[1]; + var picid_2 = picid.match(/^[0-9]{4}([0-9]{2})/)[1]; + var urls_3 = []; + if (board in archive_map) { + var provider = archive_map[board]; + if (provider === "thebarchive") { + urls_3.push("https://thebarchive.com/data/" + board + "/thumb/" + picid_4 + "/" + picid_2 + "/" + picid + "s.jpg"); + } else if (provider === "fireden") { + urls_3.push("https://img-lb.fireden.net/" + board + "/thumb/" + picid_4 + "/" + picid_2 + "/" + picid + "s.jpg"); + } else if (provider === "archiveofsins") { + urls_3.push("https://archiveofsins.com/data/" + board + "/thumb/" + picid_4 + "/" + picid_2 + "/" + picid + "s.jpg"); + } + } + urls_3.push("https://i.4cdn.org/" + board + "/" + picid + "s.jpg"); + return urls_3; + } + } // -- general rules -- if (src.match(/\/ImageGen\.ashx\?/)) { // http://www.lookalikes.info/umbraco/ImageGen.ashx?image=/media/97522/nick%20hewer%20-%20mark%20brown.jpeg&width=250&constrain=true