DraxCodes / Youtube2Mp3

Take playlists from other sources like Spotify and feed them into Youtube to get either a playable stream or a download for each track as an MP3.
GNU General Public License v3.0
8 stars 2 forks source link

Filtering tracks by duration seems to fail. #11

Closed DraxCodes closed 4 years ago

DraxCodes commented 4 years ago

I have verified that the track duration is exactly that of a song I was testing with on Youtube. It still seems to fail to find said track.

DraxCodes commented 4 years ago

After a test by track title as-well. That also seems to fail. I don't have the ability to test further on my laptop though. Will require some debuging and stepping through.

Unhandled Exception: System.Net.Http.HttpRequestException: The SSL connection could not be established, see inner exception. ---> System.Security.Authentication.AuthenticationException: Authentication failed, see inner exception. ---> System.ArgumentException: Decoded string is not a valid IDN name.
Parameter name: unicode
   at System.Globalization.IdnMapping.GetAsciiCore(String unicodeString, Char* unicode, Int32 count)
   at System.Globalization.IdnMapping.GetAscii(String unicode, Int32 index, Int32 count)
   at Interop.OpenSsl.AllocateSslContext(SslProtocols protocols, SafeX509Handle certHandle, SafeEvpPKeyHandle certKeyHandle, EncryptionPolicy policy, SslAuthenticationOptions sslAuthenticationOptions)
   at System.Net.Security.SafeDeleteSslContext..ctor(SafeFreeSslCredentials credential, SslAuthenticationOptions sslAuthenticationOptions)
   at System.Net.Security.SslStreamPal.HandshakeInternal(SafeFreeCredentials credential, SafeDeleteContext& context, SecurityBuffer inputBuffer, SecurityBuffer outputBuffer, SslAuthenticationOptions sslAuthenticationOptions)
   --- End of inner exception stack trace ---
   at System.Net.Security.SslState.StartSendAuthResetSignal(ProtocolToken message, AsyncProtocolRequest asyncRequest, ExceptionDispatchInfo exception)
   at System.Net.Security.SslState.CheckCompletionBeforeNextReceive(ProtocolToken message, AsyncProtocolRequest asyncRequest)
   at System.Net.Security.SslState.StartSendBlob(Byte[] incoming, Int32 count, AsyncProtocolRequest asyncRequest)
   at System.Net.Security.SslState.ForceAuthentication(Boolean receiveFirst, Byte[] buffer, AsyncProtocolRequest asyncRequest)
   at System.Net.Security.SslState.ProcessAuthentication(LazyAsyncResult lazyResult)
   at System.Net.Security.SslStream.BeginAuthenticateAsClient(SslClientAuthenticationOptions sslClientAuthenticationOptions, CancellationToken cancellationToken, AsyncCallback asyncCallback, Object asyncState)
   at System.Net.Security.SslStream.<>c.<AuthenticateAsClientAsync>b__47_0(SslClientAuthenticationOptions arg1, CancellationToken arg2, AsyncCallback callback, Object state)
   at System.Threading.Tasks.TaskFactory`1.FromAsyncImpl[TArg1,TArg2](Func`5 beginMethod, Func`2 endFunction, Action`1 endAction, TArg1 arg1, TArg2 arg2, Object state, TaskCreationOptions creationOptions)
   at System.Threading.Tasks.TaskFactory.FromAsync[TArg1,TArg2](Func`5 beginMethod, Action`1 endMethod, TArg1 arg1, TArg2 arg2, Object state, TaskCreationOptions creationOptions)
   at System.Threading.Tasks.TaskFactory.FromAsync[TArg1,TArg2](Func`5 beginMethod, Action`1 endMethod, TArg1 arg1, TArg2 arg2, Object state)
   at System.Net.Security.SslStream.AuthenticateAsClientAsync(SslClientAuthenticationOptions sslClientAuthenticationOptions, CancellationToken cancellationToken)
   at System.Net.Http.ConnectHelper.EstablishSslConnectionAsyncCore(Stream stream, SslClientAuthenticationOptions sslOptions, CancellationToken cancellationToken)
   --- End of inner exception stack trace ---
   at System.Net.Http.ConnectHelper.EstablishSslConnectionAsyncCore(Stream stream, SslClientAuthenticationOptions sslOptions, CancellationToken cancellationToken)
   at System.Threading.Tasks.ValueTask`1.get_Result()
   at System.Net.Http.HttpConnectionPool.CreateConnectionAsync(HttpRequestMessage request, CancellationToken cancellationToken)
   at System.Threading.Tasks.ValueTask`1.get_Result()
   at System.Net.Http.HttpConnectionPool.WaitForCreatedConnectionAsync(ValueTask`1 creationTask)
   at System.Threading.Tasks.ValueTask`1.get_Result()
   at System.Net.Http.HttpConnectionPool.SendWithRetryAsync(HttpRequestMessage request, Boolean doRequestAuth, CancellationToken cancellationToken)
   at System.Net.Http.RedirectHandler.SendAsync(HttpRequestMessage request, CancellationToken cancellationToken)
   at System.Net.Http.DecompressionHandler.SendAsync(HttpRequestMessage request, CancellationToken cancellationToken)
   at System.Net.Http.HttpClient.FinishSendAsyncUnbuffered(Task`1 sendTask, HttpRequestMessage request, CancellationTokenSource cts, Boolean disposeCts)
   at YoutubeExplode.Internal.HttpClientEx.HeadAsync(HttpClient client, String requestUri)
   at YoutubeExplode.Internal.HttpClientEx.GetContentLengthAsync(HttpClient client, String requestUri, Boolean ensureSuccess)
   at YoutubeExplode.YoutubeClient.GetVideoMediaStreamInfosAsync(String videoId)
   at Youtube2Mp3.Youtube.Services.YoutubeStreamRepository.GetStreamOfTrackAsync(Track track) in /home/drax/code/Youtube2Mp3/src/Youtube2Mp3.Youtube/Services/YoutubeStreamRepository.cs:line 27
   at Youtube2Mp3.Youtube.Services.YoutubeDownloadService.DownloadMediaAsync(Track track, String filePath) in /home/drax/code/Youtube2Mp3/src/Youtube2Mp3.Youtube/Services/YoutubeDownloadService.cs:line 19
   at Youtube2Mp3.ConsoleUi.Services.YoutubeUI.Test() in /home/drax/code/Youtube2Mp3/src/Youtube2Mp3.ConsoleUi/Services/YoutubeUI.cs:line 26
   at Youtube2Mp3.ConsoleUi.Program.Main(String[] args) in /home/drax/code/Youtube2Mp3/src/Youtube2Mp3.ConsoleUi/Program.cs:line 14
   at Youtube2Mp3.ConsoleUi.Program.<Main>(String[] args)
DraxCodes commented 4 years ago

Little further debugging has the issue at this line https://github.com/DraxCodes/Youtube2Mp3/blob/6571328033d31c4b30591701b9fd1c8a008a98b3/src/Youtube2Mp3.Youtube/Services/YoutubeStreamRepository.cs#L38

DraxCodes commented 4 years ago

After even more debugging (My Laptop is hating life lol) it seems that the following error is present in the latest revision of the branch.

Exception has occurred: CLR/System.Net.Http.HttpRequestException
An exception of type 'System.Net.Http.HttpRequestException' occurred in System.Private.CoreLib.dll but was not handled in user code: 'The SSL connection could not be established, see inner exception.'
 Inner exceptions found, see $exception in variables window for more details.
 Innermost exception     System.ArgumentException : Decoded string is not a valid IDN name.
   at System.Globalization.IdnMapping.GetAsciiCore(String unicodeString, Char* unicode, Int32 count)
   at System.Globalization.IdnMapping.GetAscii(String unicode, Int32 index, Int32 count)
   at Interop.OpenSsl.AllocateSslContext(SslProtocols protocols, SafeX509Handle certHandle, SafeEvpPKeyHandle certKeyHandle, EncryptionPolicy policy, SslAuthenticationOptions sslAuthenticationOptions)
   at System.Net.Security.SafeDeleteSslContext..ctor(SafeFreeSslCredentials credential, SslAuthenticationOptions sslAuthenticationOptions)
   at System.Net.Security.SslStreamPal.HandshakeInternal(SafeFreeCredentials credential, SafeDeleteContext& context, SecurityBuffer inputBuffer, SecurityBuffer outputBuffer, SslAuthenticationOptions sslAuthenticationOptions)