1
0
mirror of https://github.com/mxpv/podsync.git synced 2024-05-11 05:55:04 +00:00

Support YouTube mobile link formats

This commit is contained in:
Maksym Pavlenko
2017-06-16 22:43:58 -07:00
parent 106d564ddf
commit fefeacfca3
2 changed files with 4 additions and 1 deletions

View File

@@ -35,7 +35,7 @@ namespace Podsync.Services.Links
https://www.youtube.com/channel/UCrlakW-ewUT8sOod6Wmzyow/videos
*/
private static readonly Regex YouTubeRegex = new Regex(@"^(?:https?://)?(?:www\.)?(?:youtube.com/)(?<type>user|channel|playlist|watch)/?(?<id>[-\w]+)?", RegexOptions.Compiled);
private static readonly Regex YouTubeRegex = new Regex(@"^(?:https?://)?(?:www\.|m\.)?(?:youtube.com/)(?<type>user|channel|playlist|watch)/?(?<id>[-\w]+)?", RegexOptions.Compiled);
/*
Vimeo groups, channels and users

View File

@@ -18,6 +18,9 @@ namespace Podsync.Tests.Services.Links
[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")]
[InlineData("https://m.youtube.com/channel/UCrlakW-ewUT8sOod6Wmzyow/videos", LinkType.Channel, "UCrlakW-ewUT8sOod6Wmzyow")]
[InlineData("http://m.youtube.com/user/NEMAGIA/videos", LinkType.User, "NEMAGIA")]
[InlineData("http://m.youtube.com/playlist?list=PLCB9F975ECF01953C", LinkType.Playlist, "PLCB9F975ECF01953C")]
public void ParseYoutubeLinks(string link, LinkType linkType, string id)
{
var info = _linkService.Parse(new Uri(link));