Skip to content

Commit

Permalink
fix: add bvId
Browse files Browse the repository at this point in the history
  • Loading branch information
JimmyLv committed Mar 2, 2023
1 parent 6afbccc commit 56296b6
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions pages/[...slug].tsx
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +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 [loading, setLoading] = useState<boolean>(false);
const [curVideo, setCurVideo] = useState<string>("");
const [apiKey, setAPIKey] = useLocalStorage<string>("user-openai-apikey");
Expand Down Expand Up @@ -61,9 +62,8 @@ export const Home: NextPage = () => {

const videoUrl = url ? url : curVideo;
const matchResult = videoUrl.match(/\/video\/([^\/\?]+)/);
let bvId: string | undefined;
if (matchResult) {
bvId = matchResult[1];
setBvId(matchResult[1]);
} else {
return toast.error("暂不支持此视频链接");
}
Expand Down Expand Up @@ -231,7 +231,7 @@ export const Home: NextPage = () => {
target="_blank"
rel="noreferrer"
>
【📝 总结
{`【📝 总结${bvId}】`}
</a>
</h3>
<div
Expand Down

1 comment on commit 56296b6

@vercel
Copy link

@vercel vercel bot commented on 56296b6 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.