diff --git a/src/Podsync/Controllers/FeedController.cs b/src/Podsync/Controllers/FeedController.cs index 79a3d55..3d39685 100644 --- a/src/Podsync/Controllers/FeedController.cs +++ b/src/Podsync/Controllers/FeedController.cs @@ -47,9 +47,9 @@ namespace Podsync.Controllers { var linkInfo = _linkService.Parse(new Uri(request.Url)); - if (linkInfo.LinkType == LinkType.Video) + if (linkInfo.Provider != Provider.YouTube && request.Quality.HasValue && request.Quality.Value.IsAudio()) { - throw new ArgumentException("Direct links are not supported, you should provide group, channel or user link"); + throw new ArgumentException("Only YouTube supports audio feeds"); } var feed = new FeedMetadata diff --git a/src/Podsync/Helpers/Extensions.cs b/src/Podsync/Helpers/Extensions.cs index 7e175ad..6877284 100644 --- a/src/Podsync/Helpers/Extensions.cs +++ b/src/Podsync/Helpers/Extensions.cs @@ -4,6 +4,7 @@ using System.Security.Claims; using Microsoft.AspNetCore.Http; using Microsoft.AspNetCore.Mvc; using Podsync.Services; +using Podsync.Services.Resolver; namespace Podsync.Helpers { @@ -68,9 +69,14 @@ namespace Podsync.Helpers ?? "noname :("; } - public static string GetClaim(this ClaimsPrincipal claimsPrincipal, string type) + private static string GetClaim(this ClaimsPrincipal claimsPrincipal, string type) { return claimsPrincipal.Claims.FirstOrDefault(x => x.Type == type)?.Value; } + + public static bool IsAudio(this ResolveFormat format) + { + return format == ResolveFormat.AudioHigh || format == ResolveFormat.AudioLow; + } } } \ No newline at end of file