Skip to content

Commit

Permalink
fix: the regex to get bvid
Browse files Browse the repository at this point in the history
  • Loading branch information
JimmyLv committed Feb 27, 2023
1 parent e05c98c commit 5c99128
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 3 deletions.
1 change: 0 additions & 1 deletion pages/[...slug].tsx
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,6 @@ export const Home: NextPage = () => {
}, [router.isReady, urlState]);

const curUrl = String(curVideo.split(".com")[1]);
console.log('========curUrl========', curUrl)

const generateSummary = async (url?: string) => {
setSummary("");
Expand Down
5 changes: 3 additions & 2 deletions pages/api/summarize.ts
Original file line number Diff line number Diff line change
Expand Up @@ -21,11 +21,12 @@ export default async function handler(req: Request) {
}

try {
const matchResult = url.match(/\/video\/(.*)/);
const matchResult = url.match(/\/video\/([^\/\?]+)/);
let bvId: string | undefined;
if (matchResult) {
bvId = matchResult[1].replace("/", "");
bvId = matchResult[1];
}
// console.log("========url========", url, matchResult, bvId);
const response = await fetch(
`https://api.bilibili.com/x/web-interface/view?bvid=${bvId}`,
{
Expand Down

1 comment on commit 5c99128

@vercel
Copy link

@vercel vercel bot commented on 5c99128 Feb 27, 2023

Choose a reason for hiding this comment

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

Please sign in to comment.