-
Notifications
You must be signed in to change notification settings - Fork 687
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
4 changed files
with
36 additions
and
33 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,24 @@ | ||
import { sample } from "~/utils/fp"; | ||
|
||
export const fetchBilibiliSubtitleUrls = async (bvId: string) => { | ||
const requestUrl = `https://api.bilibili.com/x/web-interface/view?bvid=${bvId}`; | ||
console.log(`fetch`, requestUrl, process.env.BILIBILI_SESSION_TOKEN); | ||
const sessdata = sample(process.env.BILIBILI_SESSION_TOKEN?.split(",")); | ||
const headers = { | ||
Accept: "application/json", | ||
"Content-Type": "application/json", | ||
"User-Agent": | ||
"Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_7) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/110.0.0.0 Safari/537.36", | ||
Host: "api.bilibili.com", | ||
Cookie: `SESSDATA=${sessdata}` | ||
}; | ||
const response = await fetch(requestUrl, { | ||
method: "GET", | ||
cache: "no-cache", // *default, no-cache, reload, force-cache, only-if-cached | ||
headers, | ||
referrerPolicy: "no-referrer" // no-referrer, *no-referrer-when-downgrade, origin, origin-when-cross-origin, same-origin, strict-origin, strict-origin-when-cross-origin, unsafe-url | ||
}); | ||
const json = await response.json(); | ||
// return json.data.View; | ||
return json.data; | ||
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
2 changes: 1 addition & 1 deletion
2
lib/youtube/fetchYoutubeSubtitle.ts → lib/youtube/fetchYoutubeSubtitleUrls.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
bb0fd6c
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Successfully deployed to the following URLs:
chat-bilibili-video – ./
chat-bilibili-video-git-main-jimmylv.vercel.app
chat-bilibili-video.vercel.app
chat-bilibili-video-jimmylv.vercel.app
b.jimmylv.cn
www.bilibili.jimmylv.cn
bilibili.jimmylv.cn
m.bilibili.jimmylv.cn