diff --git a/src/utils/parseVideoID.ts b/src/utils/parseVideoID.ts index eb6f4630..032a2a68 100644 --- a/src/utils/parseVideoID.ts +++ b/src/utils/parseVideoID.ts @@ -55,7 +55,7 @@ export async function getBvIDFromURL(url: string): Promise { return idMatch[2] as VideoID; } else if (idMatch && idMatch[3]) { // av id - return await getBvIDFromCache(idMatch[3], "-1" as VideoID); + return await getBvidFromAidFromWindow(idMatch[3]); } } else if (urlObject.host == "www.bilibili.com" && urlObject.pathname.startsWith("/list/")) { const id = urlObject.searchParams.get("bvid"); @@ -65,24 +65,6 @@ export async function getBvIDFromURL(url: string): Promise { return null; } -// const AvToBvMapCache = new Map(); -// const AvToBvLoading = new Set(); -async function getBvIDFromCache(avID: string, placeholder: null | VideoID = null): Promise { - // const bvID = AvToBvMapCache.get(avID); - // if (bvID) return bvID; - - // if (!AvToBvLoading.has(avID)) { - // AvToBvLoading.add(avID); - // getBvIDfromAvIDBiliApi(avID.replace("av", "")).then((bvID) => { - // AvToBvMapCache.set(avID, bvID as VideoID); - // AvToBvLoading.delete(avID); - // }); - // } - return await getBvidFromAidFromWindow(avID); - - // return placeholder; -} - /** * Validates and sanitizes a YouTube video ID. */