Skip to content

Commit

Permalink
fix: return title and other fields
Browse files Browse the repository at this point in the history
  • Loading branch information
JimmyLv committed Mar 12, 2023
1 parent 64344a3 commit 0f11d0c
Showing 1 changed file with 15 additions and 2 deletions.
17 changes: 15 additions & 2 deletions lib/bilibili/fetchBilibiliSubtitleUrls.ts
Original file line number Diff line number Diff line change
@@ -1,9 +1,22 @@
import { find, sample } from "~/utils/fp";

type BilibiliSubtitles = {
lan: string;
subtitle_url: string;
};

interface BilibiliVideoInfo {
title: string;
desc?: string;
dynamic?: string;
subtitle?: {
list: BilibiliSubtitles[];
};
}
export const fetchBilibiliSubtitleUrls = async (
bvId: string,
partNumber?: null | string
) => {
): Promise<BilibiliVideoInfo> => {
const sessdata = sample(process.env.BILIBILI_SESSION_TOKEN?.split(","));
const headers = {
Accept: "application/json",
Expand Down Expand Up @@ -37,7 +50,7 @@ export const fetchBilibiliSubtitleUrls = async (
const j = await res.json();

// r.data.subtitle.subtitles
return { subtitle: { list: j.data.subtitle.subtitles } };
return { ...json.data, subtitle: { list: j.data.subtitle.subtitles } };
}

// return json.data.View;
Expand Down

1 comment on commit 0f11d0c

@vercel
Copy link

@vercel vercel bot commented on 0f11d0c Mar 12, 2023

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please # to comment.