fix: make sure it is a stream and it is live
This commit is contained in:
@@ -85,7 +85,7 @@ app.MapPost(ytCallback, static async (HttpContext context, [FromServices] ILogge
|
||||
return Results.NotFound();
|
||||
}
|
||||
|
||||
if (video.IsStream is false)
|
||||
if (video.IsLiveStream is false)
|
||||
{
|
||||
logger.LogInformation("Video ID {VideoId} is not a live stream.", videoId);
|
||||
return Results.Ok();
|
||||
|
||||
@@ -0,0 +1,7 @@
|
||||
namespace StevesBot.Webhook.YouTube.Data;
|
||||
|
||||
internal sealed record YouTubeSnippet
|
||||
{
|
||||
[JsonPropertyName("liveBroadcastContent")]
|
||||
public string LiveBroadcastContent { get; init; } = string.Empty;
|
||||
}
|
||||
@@ -8,5 +8,8 @@ internal sealed record YouTubeVideo
|
||||
[JsonPropertyName("liveStreamingDetails")]
|
||||
public YouTubeLiveStreamingDetails? LiveStreamingDetails { get; init; }
|
||||
|
||||
public bool IsStream => LiveStreamingDetails is not null;
|
||||
[JsonPropertyName("snippet")]
|
||||
public YouTubeSnippet Snippet { get; init; } = new();
|
||||
|
||||
public bool IsLiveStream => LiveStreamingDetails is not null && Snippet.LiveBroadcastContent is "live";
|
||||
}
|
||||
Reference in New Issue
Block a user