From dde0646e0e6953eb44af17ccaca40ce7b2469f4b Mon Sep 17 00:00:00 2001 From: Maksym Pavlenko Date: Tue, 17 Jan 2017 14:33:31 -0800 Subject: [PATCH] Fix id parser --- src/Podsync/Services/Links/LinkService.cs | 3 ++- test/Podsync.Tests/Services/Links/LinkServiceTests.cs | 1 + 2 files changed, 3 insertions(+), 1 deletion(-) diff --git a/src/Podsync/Services/Links/LinkService.cs b/src/Podsync/Services/Links/LinkService.cs index dc92bba..1e5992e 100644 --- a/src/Podsync/Services/Links/LinkService.cs +++ b/src/Podsync/Services/Links/LinkService.cs @@ -32,9 +32,10 @@ namespace Podsync.Services.Links https://www.youtube.com/playlist?list=PLCB9F975ECF01953C https://www.youtube.com/channel/UC5XPnUk8Vvv_pWslhwom6Og https://www.youtube.com/user/fxigr1 + https://www.youtube.com/channel/UCrlakW-ewUT8sOod6Wmzyow/videos */ - private static readonly Regex YouTubeRegex = new Regex(@"^(?:https?://)?(?:www\.)?(?:youtube.com/)(?user|channel|playlist|watch)/?(?\w+)?", RegexOptions.Compiled); + private static readonly Regex YouTubeRegex = new Regex(@"^(?:https?://)?(?:www\.)?(?:youtube.com/)(?user|channel|playlist|watch)/?(?[-\w]+)?", RegexOptions.Compiled); /* Vimeo groups, channels and users diff --git a/test/Podsync.Tests/Services/Links/LinkServiceTests.cs b/test/Podsync.Tests/Services/Links/LinkServiceTests.cs index c7ff3b4..31496a5 100644 --- a/test/Podsync.Tests/Services/Links/LinkServiceTests.cs +++ b/test/Podsync.Tests/Services/Links/LinkServiceTests.cs @@ -17,6 +17,7 @@ namespace Podsync.Tests.Services.Links [InlineData("https://www.youtube.com/user/UC5XPnUk8Vvv_pWslhwom6Og/playlists", LinkType.User, "UC5XPnUk8Vvv_pWslhwom6Og")] [InlineData("https://www.youtube.com/playlist?list=PLP8qlV2aurYqdhyXW9ErqUW9Fw9F_mheM", LinkType.Playlist, "PLP8qlV2aurYqdhyXW9ErqUW9Fw9F_mheM")] [InlineData("https://www.youtube.com/user/NEMAGIA/videos", LinkType.User, "NEMAGIA")] + [InlineData("https://www.youtube.com/channel/UCrlakW-ewUT8sOod6Wmzyow/videos", LinkType.Channel, "UCrlakW-ewUT8sOod6Wmzyow")] public void ParseYoutubeLinks(string link, LinkType linkType, string id) { var info = _linkService.Parse(new Uri(link));