From df179792e75e4c1c8845b151f38148f6a99f4632 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E5=A5=87=E8=B6=A3=E4=BF=9D=E7=BD=97?= Date: Sat, 6 Dec 2025 15:41:05 +0800 Subject: [PATCH] Update BiliBili toy capture --- contents/bili.ts | 40 ++++++++++++++++++++++++++++++++++++++++ 1 file changed, 40 insertions(+) diff --git a/contents/bili.ts b/contents/bili.ts index d4124e4..1b12ca6 100644 --- a/contents/bili.ts +++ b/contents/bili.ts @@ -6,6 +6,46 @@ export const config: PlasmoCSConfig = { chrome.runtime.onMessage.addListener((req, sender, send) => { if (req.type === "toolbox:getBiliToy") { + // 疑似新版? + if (window.location.pathname.includes("neul-next")) { + const item = document.querySelectorAll(".franky-swiper-item.image-list"); + + if (!item.length) { + send(false); + return; + } + + const project = document.querySelector(".tagC-ip .tagC-ip-con").innerText; + const made = document.querySelector(".tagC-ip .tagC-ip-con-brand").innerText; + + const projectExp = new RegExp(`\s?${project}\s?`); + const madeExp = new RegExp(`\s?${made}\s?`); + const name = document.querySelector(".clamp-real-text") + .innerText.replace(/\[\S+\]/, "") + .replace(projectExp, "") + .replace(madeExp, "") + .replaceAll(/\s?Q版手办\s?|\s?粘土人\s?/g, "") + .trim(); + + const images = []; + + item.forEach((item) => { + images.push( + item.querySelector("img").src + ); + }); + + send({ + name, + project: project.replace(":", ":"), + made: document.querySelector(".tagC-ip .tagC-ip-con-brand").innerText, + sale: document.querySelector(".item-complex:nth-child(4) .item-complex-value").innerText.replace("-", "/"), + images, + productId: new URLSearchParams(location.search).get("itemsId"), + }); + } + + // 旧版,不确定是否还在使用 const item = document.querySelectorAll(".silde-item"); if (item.length) {