Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

URL parsing issue in WS #124

Open
SujithThirumalaisamy opened this issue Sep 27, 2024 · 1 comment
Open

URL parsing issue in WS #124

SujithThirumalaisamy opened this issue Sep 27, 2024 · 1 comment
Assignees

Comments

@SujithThirumalaisamy
Copy link
Collaborator

SujithThirumalaisamy commented Sep 27, 2024

The URL parsing logic in WS should be handled the same as we do in next-app with the REGEX

  • Use the function isValidYoutubeURL and getVideoId to parse the videoId from all forms of youtube video urls
    utils.ts
export const YT_REGEX =
  /^(?:https?:\/\/)?(?:www\.)?(?:m\.)?(?:youtube\.com\/(?:watch\?(?!.*\blist=)(?:.*&)?v=|embed\/|v\/)|youtu\.be\/)([a-zA-Z0-9_-]{11})(?:[?&]\S+)?$/;

export const isValidYoutubeURL = (data: string) => {
  return data.match(YT_REGEX);
};

export const getVideoId = (url: string) => {
  return url.match(YT_REGEX)?.[1];
};
@geekyharsh05
Copy link
Contributor

@SujithThirumalaisamy Can you please assign me?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants