omansak / libvideo

A lightweight .NET library to download YouTube videos.
BSD 2-Clause "Simplified" License
538 stars 163 forks source link

GetBytes() failing #255

Closed NullNRG closed 1 year ago

NullNRG commented 1 year ago

GetBytes failing with error. with any video i try. here is an example video URI: Mu1vgxuWfC8

at Jurassic.Library.ArrayInstance.__STUB__ToString(Jurassic.ScriptEngine, System.Object, System.Object[]) at Jurassic.Library.ClrStubFunction.CallLateBound(System.Object, System.Object[]) at Jurassic.Library.ObjectInstance.TryCallMemberFunction(System.Object ByRef, System.Object, System.Object[]) at Jurassic.Library.ObjectInstance.GetPrimitiveValuePreES6(Jurassic.PrimitiveTypeHint) at Jurassic.Library.ObjectInstance.GetPrimitiveValue(Jurassic.PrimitiveTypeHint) at Jurassic.TypeConverter.ToPrimitive(System.Object, Jurassic.PrimitiveTypeHint) at Jurassic.TypeConverter.ToString(System.Object, System.String) at Jurassic.Library.ArrayAdapter1[[System.Canon, System.Private.CoreLib, Version=5.0.0.0, Culture=neutral, PublicKeyToken=7cec85d7bea7798e]].Join(System.String) at Jurassic.Library.ArrayInstance.Join(Jurassic.Library.ObjectInstance, System.String) at Jurassic.Library.ArrayInstance.STUBJoin(Jurassic.ScriptEngine, System.Object, System.Object[]) at Jurassic.Library.ClrStubFunction.CallLateBound(System.Object, System.Object[]) at Jurassic.Library.ObjectInstance.TryCallMemberFunction(System.Object ByRef, System.Object, System.Object[]) at Jurassic.Library.ArrayAdapter`1[[System.Canon, System.Private.CoreLib, Version=5.0.0.0, Culture=neutral, PublicKeyToken=7cec85d7bea7798e]].ToString() at Jurassic.Library.ArrayInstance.ToString(Jurassic.Library.ObjectInstance) at Jurassic.Library.ArrayInstance.STUBToString(Jurassic.ScriptEngine, System.Object, System.Object[]) at Jurassic.Library.ClrStubFunction.CallLateBound(System.Object, System.Object[]) at Jurassic.Library.ObjectInstance.TryCallMemberFunction(System.Object ByRef, System.Object, System.Object[]) at Jurassic.Library.ObjectInstance.GetPrimitiveValuePreES6(Jurassic.PrimitiveTypeHint) at Jurassic.Library.ObjectInstance.GetPrimitiveValue(Jurassic.PrimitiveTypeHint) at Jurassic.TypeConverter.ToPrimitive(System.Object, Jurassic.PrimitiveTypeHint) at Jurassic.TypeConverter.ToString(System.Object, System.String) at Jurassic.Library.ArrayAdapter1[[System.__Canon, System.Private.CoreLib, Version=5.0.0.0, Culture=neutral, at System.Threading.ExecutionContext.RunInternal(System.Threading.ExecutionContext, System.Threading.ContextCallback, System.Object) at System.Runtime.CompilerServices.AsyncTaskMethodBuilder1+AsyncStateMachineBox1[[System.Int32, System.Private.CoreLib, Version=5.0.0.0, Culture=neutral, PublicKeyToken=7cec85d7bea7798e],[System.Net.Security.SslStream+<ReadAsyncInternal>d__1811[[System.Net.Security.AsyncReadWriteAdapter, System.Net.Security, Version=5.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a]], System.Net.Security, Version=5.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a]].MoveNext(System.Threading.Thread) at System.Runtime.CompilerServices.AsyncTaskMethodBuilder1+AsyncStateMachineBox1[[System.Int32, System.Private.CoreLib, Version=5.0.0.0, Culture=neutral, PublicKeyToken=7cec85d7bea7798e],[System.Net.Security.SslStream+d181`1[[System.Net.Security.AsyncReadWriteAdapter, System.Net.Security, Version=5.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a]], System.Net.Security, Version=5.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a]].MoveNext() at System.Runtime.CompilerServices.TaskAwaiter+<>c.b12_0(System.Action, System.Threading.Tasks.Task) at System.Runtime.CompilerServices.AsyncMethodBuilderCore+ContinuationWrapper.Invoke() at System.Threading.Tasks.AwaitTaskContinuation.RunOrScheduleAction(System.Action, Boolean) at System.Threading.Tasks.Task.RunContinuations(System.Object) at System.Threading.Tasks.Task.FinishContinuations() at System.Threading.Tasks.Task1[[System.Threading.Tasks.VoidTaskResult, System.Private.CoreLib, Version=5.0.0.0, Culture=neutral, PublicKeyToken=7cec85d7bea7798e]].TrySetResult(System.Threading.Tasks.VoidTaskResult) at System.Runtime.CompilerServices.AsyncTaskMethodBuilder1[[System.Threading.Tasks.VoidTaskResult, System.Private.CoreLib, Version=5.0.0.0, Culture=neutral, PublicKeyToken=7cec85d7bea7798e]].SetExistingTaskResult(System.Threading.Tasks.Task1<System.Threading.Tasks.VoidTaskResult>, System.Threading.Tasks.VoidTaskResult) at System.Runtime.CompilerServices.AsyncValueTaskMethodBuilder.SetResult() at System.Net.Security.SslStream+<FillBufferAsync>d__1831[[System.Net.Security.AsyncReadWriteAdapter, System.Net.Security, Version=5.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a]].MoveNext() at System.Runtime.CompilerServices.AsyncTaskMethodBuilder1+AsyncStateMachineBox1[[System.Threading.Tasks.VoidTaskResult, System.Private.CoreLib, Version=5.0.0.0, Culture=neutral, PublicKeyToken=7cec85d7bea7798e],[System.Net.Security.SslStream+d1831[[System.Net.Security.AsyncReadWriteAdapter, System.Net.Security, Version=5.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a]], System.Net.Security, Version=5.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a]].ExecutionContextCallback(System.Object) at System.Threading.ExecutionContext.RunInternal(System.Threading.ExecutionContext, System.Threading.ContextCallback, System.Object) at System.Runtime.CompilerServices.AsyncTaskMethodBuilder1+AsyncStateMachineBox`1[[System.Threading.Tasks.VoidTaskResult, System.Private.CoreLib, Version=5.0.0.0, Culture=neutral, PublicKeyToken=7cec85d7bea7798e],[System.Net.Security.SslStream+d1831[[System.Net.Security.AsyncReadWriteAdapter, System.Net.Security, Version=5.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a]], System.Net.Security, Version=5.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a]].MoveNext(System.Threading.Thread) at System.Runtime.CompilerServices.AsyncTaskMethodBuilder1+AsyncStateMachineBox1[[System.Threading.Tasks.VoidTaskResult, System.Private.CoreLib, Version=5.0.0.0, Culture=neutral, PublicKeyToken=7cec85d7bea7798e],[System.Net.Security.SslStream+<FillBufferAsync>d__1831[[System.Net.Security.AsyncReadWriteAdapter, System.Net.Security, Version=5.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a]], System.Net.Security, Version=5.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a]].MoveNext() at System.Threading.ThreadPool+<>c.<.cctor>b__60_0(System.Object) at System.Net.Sockets.Socket+AwaitableSocketAsyncEventArgs.InvokeContinuation(System.Action1<System.Object>, System.Object, Boolean, Boolean) at System.Net.Sockets.Socket+AwaitableSocketAsyncEventArgs.OnCompleted(System.Net.Sockets.SocketAsyncEventArgs) at System.Net.Sockets.SocketAsyncEventArgs.OnCompletedInternal() at System.Net.Sockets.SocketAsyncEventArgs+<>c.<.cctor>b__179_0(UInt32, UInt32, System.Threading.NativeOverlapped*) at System.Threading.ThreadPoolBoundHandleOverlapped.CompletionCallback(UInt32, UInt32, System.Threading.NativeOverlapped*) at System.Threading._IOCompletionCallback.PerformIOCompletionCallback(UInt32, UInt32, System.Threading.NativeOverlapped*)

NullNRG commented 1 year ago

i should mention the exact same code was working the day prior. now is failing

hondek commented 1 year ago

Yep, its my fault, just merge my last pull request and will be fine everything.

omansak commented 1 year ago

i merged can you test now ?

hondek commented 1 year ago

Hi,

Tested but it wasnt problem...

But i know what is problem this time:

Sometime in descramble function youtube developers put Dates instead of Numbers and then JavaScript Engine (Jurassic) cant correct fire javascript descramble function.

In my desktop app i using WebView, and executing descramble function in webview and it working correct.

But i dont know it is possible to use WebView in this project.

Problem is at: YoutubeVideo.Descramble.cs Line: 29 var sign = engine.CallGlobalFunction<string>(descrambleFunction.Item1, signature);

This line crash script, coz of this Dates instead of Numbers in javascript like this:

c[new Date("01 January 1970 00:00:57 GMT")/1E3],c[14],c[9]),c[40])((0,c[40])((0,c[4])(c[4830+Math.pow(1,new Date("01 January 1970 07:45:03 +0745")/1E3)
hondek commented 1 year ago

Problem is Jurassic Engine throw StackOverflowException so we cant catch it :(

hondek commented 1 year ago

Hi guys,

today descramble function for this video was changed and parsing by Jurassic normally.

But i think youtube randomly testing this option.

If you will get this errror again please save somewhere string with javascript code - we will be able to test it from a file.

NullNRG commented 1 year ago

Hi guys,

today descramble function for this video was changed and parsing by Jurassic normally.

But i think youtube randomly testing this option.

If you will get this errror again please save somewhere string with javascript code - we will be able to test it from a file.

Hi, thank you for all the work looking into this issue. I haven't yet been able to test anything here as I have been away. But glad to see it is working as normal again for now.

gliderman commented 1 year ago

Howdy, I'm encountering this issue on every video URL I try to pass. Doesn't seem to matter if it's new or old, different channels, etc. Any URI I try to access is tripping that stack overflow error. I saw you need the Javascript code that's returned from YouTube, how would I go about obtaining this for debugging?

Hummingbirdy commented 1 year ago

I'm also still having this issue. Using code and a YouTube link that worked fine two weeks ago. Is their a workaround?

omansak commented 1 year ago

270