Tyrrrz / YoutubeExplode

Abstraction layer over YouTube's internal API
MIT License
2.92k stars 487 forks source link

Error `iso-2022-cn` is not a supported encoding name #825

Open Mindrix95 opened 1 week ago

Mindrix95 commented 1 week ago

Version

6.8.1

Platform

.NET 8.0 / Windows 11

Steps to reproduce

public class YoutubeService
{
    YoutubeClient youtubeClient;
    public YoutubeService()
    {
        youtubeClient = new YoutubeClient();
    }
    public async Task<Stream> DownloadVideo(string url)
    {
        var video = await youtubeClient.Videos.GetAsync(url); //Error
        var streamManifest = await youtubeClient.Videos.Streams.GetManifestAsync(video.Url);
        var streamInfo = streamManifest.GetMuxedStreams().GetWithHighestVideoQuality();
        return await youtubeClient.Videos.Streams.GetAsync(streamInfo);
    }
}
string url = "randomUrl"
var stream = await youtubeServices.DownloadVideo(url);

Details

When this line is executed :

var video = await youtubeClient.Videos.GetAsync(url);

I get the error :

System.ArgumentException : ''iso-2022-cn' is not a supported encoding name. For information on defining a custom encoding, see the documentation for the Encoding.RegisterProvider method. Arg_ParamName_Name

   at System.Text.EncodingTable.InternalGetCodePageFromName(String name)
   at System.Text.EncodingTable.GetCodePageFromName(String name)
   at System.Text.Encoding.GetEncoding(String name)
   at AngleSharp.Text.TextEncoding.GetEncoding(String name, Encoding fallback)

Don't hesitate to contact me if you need more information.

Checklist

Tyrrrz commented 1 week ago

Interesting. What locale is set on the machine that runs that code?

Mindrix95 commented 1 week ago

Current locale: ('English_United Kingdom', '1252')

Tyrrrz commented 1 week ago

Which video were you fetching?

Mindrix95 commented 1 week ago

This one for exemple : https://youtu.be/ZdeiaXLug5w?si=zkQyTaRsunZj5FD4

Mindrix95 commented 1 week ago

image