diff --git a/src/markdown/embed-transformers/Bilibili.ts b/src/markdown/embed-transformers/Bilibili.ts index f9d8183f..1bfb556f 100644 --- a/src/markdown/embed-transformers/Bilibili.ts +++ b/src/markdown/embed-transformers/Bilibili.ts @@ -16,12 +16,15 @@ const getTimeValueInSeconds = (timeValue: string) => { } const getBilibiliIFrameSrc = (url: URL) => { - const match = url.pathname.match(/\/video\/([A-Za-z0-9]+)\//) + const match = url.pathname.match(/\/video\/([A-Za-z0-9]+)\/?/) if (!match || match.length < 1) return const bvid = match[1] + const page = url.searchParams.get('p') + const pageParam = (page) ? `&page=${page}` : '' + const embedUrl = new URL( - `https://player.bilibili.com/player.html?bvid=${bvid}&autoplay=false`, + `https://player.bilibili.com/player.html?bvid=${bvid}&autoplay=false` + pageParam, ) return embedUrl.toString()