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

fix: handle YouTube URLs in any format to correctly extract video ID #77

Merged
merged 4 commits into from
Sep 11, 2024

Conversation

Manoo07
Copy link
Contributor

@Manoo07 Manoo07 commented Sep 10, 2024

Fixes #12 , #32 , #33
This PR adds :

  • Addresses an issue where the application was unable to extract the YouTube video ID from URLs that did not match a specific format.
  • The previous implementation had limitations, causing failures when encountering alternate or non-standard YouTube URL structures, such as URLs containing parameters, shortened links, or embedded formats.

image

@SujithThirumalaisamy
Copy link
Collaborator

Can you please fix the lint

@SujithThirumalaisamy
Copy link
Collaborator

Ideally this is a few line changes. Please open a new PR without the lints

@Manoo07
Copy link
Contributor Author

Manoo07 commented Sep 11, 2024

Sure

@Manoo07
Copy link
Contributor Author

Manoo07 commented Sep 11, 2024

Hey @SujithThirumalaisamy ,I have fixed the lint Please review

@@ -55,7 +55,7 @@ export async function POST(req: NextRequest) {
);
}

const extractedId = data.url.split("?v=")[1];
const extractedId = data.url.split("?v=")[1].split("&")[0];
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This will fail for shorterned links like https://youtu.be/dQw4w9WgXcQ

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hey @SujithThirumalaisamy ,Thanks for pointing that out.
This should now correctly handle both standard and shortened YouTube URLs. Please test it with different URL formats and let me know if there are any other issues.

@SujithThirumalaisamy
Copy link
Collaborator

Merging this for now. Can fix if there are something more. I think of nothing

@SujithThirumalaisamy SujithThirumalaisamy merged commit c20657a into code100x:main Sep 11, 2024
1 check failed
@Manoo07 Manoo07 deleted the fix/youtube-url branch September 16, 2024 04:29
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

Successfully merging this pull request may close these issues.

Songs not loading up on dashboard
2 participants