Skip to content

Commit

Permalink
fix: bvid issue
Browse files Browse the repository at this point in the history
  • Loading branch information
JimmyLv committed Mar 2, 2023
1 parent 3d30c57 commit 143d033
Showing 1 changed file with 5 additions and 3 deletions.
8 changes: 5 additions & 3 deletions pages/[...slug].tsx
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ export const Home: NextPage = () => {
const router = useRouter();
const urlState = router.query.slug;
const [summary, setSummary] = useState<string>("");
const [bvId, setBvId] = useState<string>("");
const [currentBvId, setCurrentBvId] = useState<string>("");
const [loading, setLoading] = useState<boolean>(false);
const [curVideo, setCurVideo] = useState<string>("");
const [apiKey, setAPIKey] = useLocalStorage<string>("user-openai-apikey");
Expand Down Expand Up @@ -64,8 +64,10 @@ export const Home: NextPage = () => {
validateUrl(url);
const videoUrl = url ? url : curVideo;
const matchResult = videoUrl.match(/\/video\/([^\/\?]+)/);
let bvId: string | undefined;
if (matchResult) {
setBvId(matchResult[1]);
bvId = matchResult[1];
setCurrentBvId(matchResult[1]);
} else {
return toast.error("暂不支持此视频链接");
}
Expand Down Expand Up @@ -233,7 +235,7 @@ export const Home: NextPage = () => {
target="_blank"
rel="noreferrer"
>
{`【📝 总结:${bvId}】`}
{`【📝 总结:${currentBvId}】`}
</a>
</h3>
<div
Expand Down

1 comment on commit 143d033

@vercel
Copy link

@vercel vercel bot commented on 143d033 Mar 2, 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.