Tyrrrz / YoutubeDownloader

Downloads videos and playlists from YouTube
MIT License
8.71k stars 1.19k forks source link

Crash while authenticating #351

Closed CanePlayz closed 1 year ago

CanePlayz commented 1 year ago

Version

1.10.0

Details

When I try to authenticate, this error message occurs once the WebView window gets closed:

image

If I close that error message window, it pops up one more time and when I close that new window, the program crashes.

Steps to reproduce

-Try to authenticate

xBaank commented 1 year ago

It also happens to me. I think one fix could be to just get the cookies of https://www.youtube.com because it seems that https://www.google.com and https://www.youtube.com share somes cookies and they can't be mapped into a dictionary.

So instead of : https://github.com/Tyrrrz/YoutubeDownloader/blob/e045cf0b315024d903cc003d9a349ffbd328ff8b/YoutubeDownloader/Views/Dialogs/AuthSetupView.xaml.cs#L63 Just get youtube cookies:

var cookies = await WebBrowser.CoreWebView2.CookieManager.GetCookiesAsync("https://www.youtube.com");

Other fix could be using the list of cookies directly instead of the dictionary mapping them from WebView2Cookie to Cookie like this:

ViewModel.Cookies = cookies.Select(i => i.ToSystemNetCookie())

And don't specify the domain in: https://github.com/Tyrrrz/YoutubeDownloader/blob/e045cf0b315024d903cc003d9a349ffbd328ff8b/YoutubeDownloader.Core/YoutubeAuthHttpHandler.cs#L21

as the cookies already have the domain information.

Tyrrrz commented 1 year ago

Thanks guys, I'll check later today

ScottsplaysSus commented 1 year ago

Same issue here, hope it can be fixed :)

image image

Tyrrrz commented 1 year ago

This is fixed. You might have to delete your Settings.dat file if you run into exceptions during startup (shouldn't happen though).