Skip to content

Commit

Permalink
fix: not validate url for youtube.com
Browse files Browse the repository at this point in the history
  • Loading branch information
JimmyLv committed Mar 7, 2023
1 parent 14e8853 commit e224ffb
Showing 1 changed file with 4 additions and 3 deletions.
7 changes: 4 additions & 3 deletions pages/[...slug].tsx
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand Down Expand Up @@ -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 },
Expand All @@ -86,6 +86,7 @@ export const Home: NextPage = () => {
return;
}

validateUrl(url);
const bvId = extractUrl(videoUrl);
if (!bvId) {
return;
Expand Down

1 comment on commit e224ffb

@vercel
Copy link

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