图源
图源链接
注:本帖所提供的只供非盈利性使用,引用获得的图片请标明在画廊中提到的原作者,而非本人!
获取方式
因为官方它把图片放在源码,同时你在网页中是下不到的。这里给个代码,放在F12的控制台中,就可以下载192张照片。包括网站本身的一些背景。下载好后你可以筛选出那些01XX 02XX 03XX 04XX开头的图片,这些就是很好的背景。可以配合脚本——通用壁纸来美化浏览器。
第一步
提取图片地址。 ::::info[代码]
(async () => {
const html = await fetch(location.href).then(r => r.text());
const matches = html.match(
/(?:https:\/\/web\.hycdn\.cn)?\/endfield\/special\/over-the-frontier\/assets\/imgs\/[^"'\\\s]+?\.(?:jpg|jpeg|png|webp)/gi
) || [];
const urls = [...new Set(matches)].map(x =>
x.startsWith("http")
? x
: "https://web.hycdn.cn" + x
);
window.galleryURLs = urls;
console.log("提取完成!");
console.log("图片数量:", urls.length);
console.table(urls);
// 使用浏览器剪贴板 API
try {
await navigator.clipboard.writeText(urls.join("\n"));
console.log("已复制全部图片地址!");
} catch (e) {
console.warn("自动复制失败,请手动复制下面的结果");
}
// 在页面显示可复制的文本框
const box = document.createElement("textarea");
box.value = urls.join("\n");
box.style.cssText =
"position:fixed;z-index:999999;top:10px;left:10px;" +
"width:80%;height:70%;background:white;color:black;";
document.body.appendChild(box);
box.select();
console.log("图片地址已放入页面文本框。");
})();
:::: 第二步
下载。 ::::info[代码]
(async () => {
const urls = window.galleryURLs;
if (!urls || !urls.length) {
console.error("没有找到图片清单,请重新提取");
return;
}
const dir = "Endfield_Gallery";
let success = 0;
const failed = [];
for (let i = 0; i < urls.length; i++) {
const url = urls[i];
const name = decodeURIComponent(
new URL(url).pathname.split("/").pop()
);
try {
const res = await fetch(url, {
mode: "cors",
credentials: "omit"
});
if (!res.ok) throw new Error("HTTP " + res.status);
const blob = await res.blob();
const objectURL = URL.createObjectURL(blob);
const a = document.createElement("a");
a.href = objectURL;
a.download = name;
document.body.appendChild(a);
a.click();
a.remove();
setTimeout(() => URL.revokeObjectURL(objectURL), 60000);
success++;
console.log(`[${i + 1}/${urls.length}] ${name}`);
} catch (e) {
failed.push({ name, url, error: e.message });
console.error("失败:" + name, e);
}
await new Promise(r => setTimeout(r, 500));
}
console.log("下载任务结束");
console.log("成功:" + success);
console.log("失败:" + failed.length);
window.galleryFailed = failed;
})();
::::