/*
https://t.me/ibilibili
2026-07-11 20:05:34
*/
let body = $response.body || "";
const oldChunk = "https://pfile.pddpic.com/mdkd/mdkd/_next/static/chunks/9410-b8806e870a26db7d.js";
const newChunk = "https://kelee.one/Resource/JavaScript/PinDuoDuo/9410-b8806e870a26db7d.js";
function replaceAllText(text, from, to) {
let pos = text.indexOf(from);
while (pos !== -1) {
text = text.slice(0, pos) + to + text.slice(pos + from.length);
pos = text.indexOf(from, pos + to.length);
}
return text;
}
function removeGifContainer(html) {
const marker = "index_gif-container";
let pos = html.indexOf(marker);
while (pos !== -1) {
const open = html.lastIndexOf("
", i);
if (nextClose === -1) break;
if (nextOpen !== -1 && nextOpen < nextClose) {
depth++;
i = nextOpen + 4;
} else {
depth--;
i = nextClose + 6;
if (depth === 0) {
end = i;
break;
}
}
}
if (end === -1) break;
html = html.slice(0, open) + html.slice(end);
pos = html.indexOf(marker, open);
}
return html;
}
function trimNextData(html) {
const idNeedle = 'id="__NEXT_DATA__"';
const idPos = html.indexOf(idNeedle);
if (idPos === -1) return html;
const tagStart = html.lastIndexOf("", contentStart);
if (tagEnd === -1) return html;
const jsonText = html.slice(contentStart + 1, tagEnd);
try {
const data = JSON.parse(jsonText);
const serverData = data &&
data.props &&
data.props.pageProps &&
data.props.pageProps.serverData;
if (Array.isArray(serverData)) {
data.props.pageProps.serverData = serverData.filter(item =>
item &&
(item.key === "fastBindCMobilePreCheck" ||
item.key === "queryStationPackageInfo")
);
}
return html.slice(0, contentStart + 1) +
JSON.stringify(data) +
html.slice(tagEnd);
} catch (e) {
return html;
}
}
body = replaceAllText(body, oldChunk, newChunk);
body = removeGifContainer(body);
body = trimNextData(body);
$done({ body });