fix(bilibili): preserve video pages and CDN playback headers

This commit is contained in:
NoSetViolin committed 2026-11-12 18:07:52 +09:00
1 parent 17008ae52e
commit b7779ab108
5 files changed
+65 -2

No files matched your search

+5 -1
View File
@@ -69,7 +69,11 @@ export function parseSongRef(raw: string): SongRef | null {
// a "BV..." token never collides with them).
const bv = /BV[0-9A-Za-z]{8,12}/.exec(q);
if (bv && (/^BV[0-9A-Za-z]{8,12}$/.test(q) || /bilibili\.com|b23\.tv/i.test(q))) {
return { id: bv[0], platform: "bilibili" };
// TeamSpeak wraps pasted links in [URL] tags. Keep the page query while
// ignoring fragments, which can contain unrelated player state.
const query = /\?(.*)$/.exec(stripUrlBBCode(q).trim().split("#", 1)[0])?.[1];
const page = new URLSearchParams(query).get("p");
return { id: page && /^\d+$/.test(page) ? `${bv[0]}?p=${page}` : bv[0], platform: "bilibili" };
}
// NetEase song URL. Only treat `id=N` as a SONG id when the URL is not a