Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
13 changes: 13 additions & 0 deletions TS3AudioBot/ResourceFactories/Youtube/YoutubeResolver.cs
Original file line number Diff line number Diff line change
Expand Up @@ -160,6 +160,19 @@ private static async Task<PlayResource> YoutubeDlWrapped(AudioResource resource,
throw Error.LocalStr(strings.error_ytdl_empty_response);

Log.Debug("youtube-dl succeeded!");

if (format!.available_at.HasValue)
{
var availableTime = Tools.FromUnix(format.available_at.Value);
var waitTime = availableTime - DateTime.UtcNow;

if (waitTime > TimeSpan.Zero)
{
Log.Debug($"Waiting youtube delay: {waitTime}");
await Task.Delay(waitTime, cancellationToken);
}
}

return new PlayResource(url, resource, songInfo: songInfo);
}

Expand Down
1 change: 1 addition & 0 deletions TS3AudioBot/ResourceFactories/YoutubeDlHelper.cs
Original file line number Diff line number Diff line change
Expand Up @@ -320,6 +320,7 @@ public class JsonYtdlFormat
public string? format_id { get; set; }
public string? url { get; set; }
public string? ext { get; set; }
public uint? available_at { get; set; }
}

public class JsonYtdlPlaylistDump : JsonYtdlBase
Expand Down