From bb05561b5b890dd2ce8c7fa36edc3f6c281bbf17 Mon Sep 17 00:00:00 2001 From: Ovler Date: Tue, 25 Jun 2024 02:23:04 +0800 Subject: [PATCH] chore: Refactor queue() API to use ArchivedItem interface --- src/lib/server/api.ts | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/src/lib/server/api.ts b/src/lib/server/api.ts index 90257bc..d41c931 100644 --- a/src/lib/server/api.ts +++ b/src/lib/server/api.ts @@ -1,6 +1,13 @@ import { None, Option, Some } from "ts-results-es"; import Bvid from "../bv.js"; import { XMLParser } from "fast-xml-parser"; + +interface ArchivedItem { + added_time: number; + bvid: string; + status: string; +} + export class BiliArchiver { endpoint: URL; @@ -32,7 +39,7 @@ export class BiliArchiver { const res = await fetch(url.toString()); const items = (await res.json())?.items; // filter those not finished - return items.filter((item: any) => item.status !== "finished").map((item: any) => item.bvid); + return items.filter((item: ArchivedItem) => item.status !== "finished").map((item: ArchivedItem) => item.bvid); } catch (e) { console.error(e); return [];