From e224ffb91797af58fecea60883c1f61d579cf2c8 Mon Sep 17 00:00:00 2001 From: JimmyLv Date: Tue, 7 Mar 2023 13:00:53 +0800 Subject: [PATCH] fix: not validate url for youtube.com --- pages/[...slug].tsx | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/pages/[...slug].tsx b/pages/[...slug].tsx index 46f459a5..663ad6a1 100644 --- a/pages/[...slug].tsx +++ b/pages/[...slug].tsx @@ -40,6 +40,8 @@ export const Home: NextPage = () => { }, [licenseKey]); useEffect(() => { + // https://www.youtube.com/watch?v=DHhOgWPKIKU + // todo: support redirect from www.youtube.jimmylv.cn/watch?v=DHhOgWPKIKU const validatedUrl = getValidatedUrl( router.isReady, currentVideoUrl, @@ -73,11 +75,9 @@ export const Home: NextPage = () => { }; const generateSummary = async (url?: string) => { resetSummary(); - validateUrl(url); - const videoUrl = url || currentVideoUrl; const { id, service } = getVideoId(videoUrl); - if (service === "youtube" && id) { + if (service === VideoService.Youtube && id) { setCurrentVideoId(id); await summarize( { videoId: id, service: VideoService.Youtube }, @@ -86,6 +86,7 @@ export const Home: NextPage = () => { return; } + validateUrl(url); const bvId = extractUrl(videoUrl); if (!bvId) { return;