Bluegrams / YoutubeDLSharp

A simple .NET wrapper library for youtube-dl and yt-dlp
BSD 3-Clause "New" or "Revised" License
173 stars 30 forks source link

[Bug] New YT-DLP version breaks Newtonsoft JsonReader #24

Closed DontEatOreo closed 1 year ago

DontEatOreo commented 1 year ago

It seems like the new yt-dlp version broke the jsonreader

I'm using version 1.0.0-beta2

Unhandled exception. Newtonsoft.Json.JsonReaderException: Input string '1.0' is not a valid integer. Path 'formats[3].quality', line 1, position 9500.
   ...

Sample Code:

using YoutubeDLSharp;
using YoutubeDLSharp.Options;

YoutubeDL youtubeDl = new()
{
    YoutubeDLPath = "yt-dlp",
    FFmpegPath = "ffmpeg",
    OutputFolder = Path.GetTempPath(),
    OutputFileTemplate = "%(id)s.%(ext)s",
};

const string url = "https://youtu.be/sca4VG9b0NY";

var videoDataFetch = await youtubeDl.RunVideoDataFetch(url, flat: true);

var duration = videoDataFetch.Data.Duration;
var tags = videoDataFetch.Data.Tags;

Console.WriteLine($"Duration: {duration}");
Console.WriteLine($"Tags: {string.Join(", ", tags)}");

await youtubeDl.RunAudioDownload(url, AudioConversionFormat.Opus);