Skip to content

Commit

Permalink
🐛 Fix mistaken playlist url. Closes #73
Browse files Browse the repository at this point in the history
  • Loading branch information
pitzzahh committed Aug 28, 2024
1 parent c5e801e commit 01360ab
Showing 1 changed file with 7 additions and 4 deletions.
11 changes: 7 additions & 4 deletions MediaClippex/Services/StringService.cs
Original file line number Diff line number Diff line change
Expand Up @@ -72,16 +72,19 @@ public static bool IsYouTubePlaylistUrl(string url)
return YoutubePlaylistRegex().Match(url).Success;
}


private static Regex YoutubeUrlRegex()
{
return new Regex(
"(?:youtu\\.be/|youtube\\.com/(?:embed/|v/|shorts/|watch\\?v=|watch\\?.+&v=))([^?&\"'>]+)(?:&list=([^?&\"'>]+))?");
@"(?:https?:\/\/)?(?:www\.)?(?:youtube\.com\/(?:playlist\?list=|(?:embed|v|shorts|watch\?v=)|watch\?.+&v=)|youtu\.be\/)([^""&?\/\s]+)(?:&list=([^""&?\/\s]+))?",
RegexOptions.IgnoreCase
);
}

private static Regex YoutubePlaylistRegex()
{
// This regular expression matches YouTube playlist URLs
return new Regex("(?:youtu\\.be/|youtube\\.com/playlist\\?list=)([^?&\"'>]+)");
return new Regex(
@"(?:https?:\/\/)?(?:www\.)?(?:youtube\.com\/playlist\?list=|youtu\.be\/(?:.+?\/)?(?:playlist\?list=)?|youtube\.com\/(?:embed|v|shorts|watch\?v=|watch\?.+&v=))?([^""&?\/\s]+)",
RegexOptions.IgnoreCase
);
}
}

0 comments on commit 01360ab

Please sign in to comment.