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:
@@ -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
|
||||
|
||||
@@ -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));
|
||||
|
||||
Reference in New Issue
Block a user