From c50ec6454c0e129b3d86d9f9e8c7c1fc541c3f0f Mon Sep 17 00:00:00 2001 From: hama3254 Date: Sun, 9 Apr 2023 09:31:16 +0200 Subject: [PATCH] reorganized some code parts reorganized some code parts --- .vs/Crunchyroll Downloader/v17/.suo | Bin 205312 -> 209920 bytes Crunchyroll Downloader/Anime_Add.vb | 17 +- Crunchyroll Downloader/Browser.vb | 22 - .../Crunchyroll Downloader.vbproj | 1 + Crunchyroll Downloader/GetData.vb | 233 +++++++++ Crunchyroll Downloader/Main.vb | 447 +++--------------- 6 files changed, 322 insertions(+), 398 deletions(-) create mode 100644 Crunchyroll Downloader/GetData.vb diff --git a/.vs/Crunchyroll Downloader/v17/.suo b/.vs/Crunchyroll Downloader/v17/.suo index 46d2104fd3e837f12c9019e551624160821b2647..34c2082a0376782e5fbc52b8e4d4e5681e0453f9 100644 GIT binary patch delta 12310 zcmeHN3tW{&+CR^n19BG;6&3IZYG`1GiwJn(a8XHFAvHw>CQvBuBIT^0KLC z%&{^fG~F#z;S|UGN{?CEn(J-L%uQD4~z~2Ei5Cy~mJ%C=oFu(=qt5DP` zZXnVXco1+0CIOv+3LqTt1$00R&=KYjK`0GLKo|`80o?!%Am!-@#{(mQhk!mnGVm?Z zWLJ&`9sp$CP}HxujGJk|ASmx=PmqZ{5sw4{fi^$^kO(m3yM<6H`~;!Q>$tLU9{}V4 zgMoZNrVT_W^A{q#2z0c|Cr+_PWTq0t9|1~%)4Nn0(mm$y>#b>K~n?lq~W$F>$?Vq;E#cGr3de2ZM0;_4Gl9sjD zBraD|hPz?~>Xe+k-N+fJH;&J)jo=}EUAWdi#^otUdf6=LbCT*SS^XSlw50IeEYhU6 zETuMC2PI7vyiHWRF)B=S4`Tt`5M`l@Jn7LtnF3=zbuoT?joR_+9}ky>xc)?j3_YJh zAvvMq68V=|2CtjyW6B=5zKyJ7sLHriuL?%prdeAx6I?^Ynd^@Y82Ne9JJLlAk$6y!a`YrV-&sOp`fpW37amtVjB-l=$Gsyo4b*H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X#U+v{rl%sYA;Ye4w z70bW!f;gc5F92<+`<{<@`)09LimEi3R`rMP=E9D=_Pk=VFw+>`cO5%Wdx1f|lXjWW zd^GDT(8o`<@W=mp9bfeBGQV5zt2jCcCrIlC5q?YE19;XxQAsD&6yK~PS3@4ZSA5`Q z#=~OUtTp2GFOE*60snkHCVdRaUCQi||d+5GP#4W*+~BXafqw91$OK zWm6H(?*9S@0&10G*9ILBU5OVR6bCi?Tgn!!@1WOR|pi9=pzAdcSSF;$x9TI~ezU zFRDS}S?s8EdXK}l_sZa97vS~bN4!i?-9~C~Rnz=ge1b#fk7|QjKY^FL`k%okAr}Ep z0gHj3151FX0pIt+RC#cCD3@KL02ytC&&2$-!i(anzt8gJ^ucDRCz-dO66fliN&v3h z@V?p3)~)zf25Uu?AsTXiN7{aiUp&!yu6|FP<{{@WPq)QS53}7D;&~OocXakM(S Form + queue.vb diff --git a/Crunchyroll Downloader/GetData.vb b/Crunchyroll Downloader/GetData.vb new file mode 100644 index 0000000..87c6f6c --- /dev/null +++ b/Crunchyroll Downloader/GetData.vb @@ -0,0 +1,233 @@ +Imports System.IO +Imports System.Text + +Module GetData + +#Region "curl" + + Public Function Curl(ByVal Url As String) As String + + Dim exepath As String = Path.Combine(Application.StartupPath, "lib", "curl.exe") + Dim startinfo As New System.Diagnostics.ProcessStartInfo + Dim sr As StreamReader + Dim sr2 As StreamReader + Dim cmd As String = "" + If Main.Curl_insecure = True Then + cmd = "--insecure " + End If + cmd = cmd + "--no-alpn -fsSLm 15 -A " + My.Resources.ffmpeg_user_agend.Replace("User-Agent: ", "") + " " + Chr(34) + Url + Chr(34) + Dim Proc As New Process + 'MsgBox(cmd) + Dim CurlOutput As String = Nothing + Dim CurlError As String = Nothing + ' all parameters required to run the process + startinfo.FileName = exepath + startinfo.Arguments = cmd + startinfo.UseShellExecute = False + startinfo.WindowStyle = ProcessWindowStyle.Normal + startinfo.RedirectStandardError = True + startinfo.RedirectStandardOutput = True + startinfo.CreateNoWindow = True + startinfo.StandardOutputEncoding = Encoding.UTF8 + startinfo.StandardErrorEncoding = Encoding.UTF8 + Proc.StartInfo = startinfo + Proc.Start() ' start the process + sr = Proc.StandardOutput 'standard error is used by ffmpeg + sr2 = Proc.StandardError + 'sw = proc.StandardInput + + Dim start, finish, pau As Double + start = CSng(Microsoft.VisualBasic.DateAndTime.Timer) + pau = 5 + finish = start + pau + + Do + CurlOutput = CurlOutput + sr.ReadToEnd + CurlError = CurlError + sr2.ReadToEnd + 'ffmpegOutput2 = sr.ReadLine + 'Debug.WriteLine(CurlOutput) + + Loop Until Proc.HasExited Or Microsoft.VisualBasic.DateAndTime.Timer < finish + + + If CurlOutput = Nothing And CurlError = Nothing Then + Debug.WriteLine("curl-E: " + "curl: ") + Return CurlError + ElseIf CurlOutput = Nothing And CurlError IsNot Nothing Then + Debug.WriteLine("curl-E: " + CurlError) + Return CurlError + ElseIf CurlOutput IsNot Nothing And CurlError = Nothing Then + Debug.WriteLine("curl-O: " + CurlOutput) + Return CurlOutput + ElseIf CurlOutput IsNot Nothing And CurlError IsNot Nothing Then + Debug.WriteLine("curl-O: " + CurlOutput) + Return CurlOutput + Else + Debug.WriteLine("curl-E: " + "curl: ") + Return CurlError + End If + + + End Function + + Public Function CurlPost(ByVal Url As String, ByVal Cookies As String, ByVal Auth As String, ByVal Post As String) As String + + + Dim exepath As String = Path.Combine(Application.StartupPath, "lib", "curl.exe") + + Dim startinfo As New System.Diagnostics.ProcessStartInfo + Dim sr As StreamReader + Dim sr2 As StreamReader + + + Dim cmd As String = "" + If Main.Curl_insecure = True Then + cmd = "--insecure " + End If + cmd = cmd + "--no-alpn -fsSLm 15 -A " + My.Resources.ffmpeg_user_agend.Replace("User-Agent: ", "") + Cookies + Auth + Post + " " + Chr(34) + Url + Chr(34) + Dim Proc As New Process + 'Debug.WriteLine("CurlPost: " + cmd) + Dim CurlOutput As String = Nothing + Dim CurlError As String = Nothing + ' all parameters required to run the process + startinfo.FileName = exepath + startinfo.Arguments = cmd + startinfo.UseShellExecute = False + startinfo.WindowStyle = ProcessWindowStyle.Normal + startinfo.RedirectStandardError = True + startinfo.RedirectStandardOutput = True + startinfo.CreateNoWindow = True + startinfo.StandardOutputEncoding = Encoding.UTF8 + startinfo.StandardErrorEncoding = Encoding.UTF8 + Proc.StartInfo = startinfo + Proc.Start() ' start the process + sr = Proc.StandardOutput 'standard error is used by ffmpeg + sr2 = Proc.StandardError + 'sw = proc.StandardInput + Dim start, finish, pau As Double + start = CSng(Microsoft.VisualBasic.DateAndTime.Timer) + pau = 5 + finish = start + pau + + Do + CurlOutput = CurlOutput + sr.ReadToEnd + CurlError = CurlError + sr2.ReadToEnd + 'ffmpegOutput2 = sr.ReadLine + 'Debug.WriteLine(CurlOutput) + + Loop Until Proc.HasExited Or Microsoft.VisualBasic.DateAndTime.Timer < finish + + + If CurlOutput = Nothing And CurlError = Nothing Then + Debug.WriteLine("CurlPost-E: " + "curl: ") + Return CurlError + ElseIf CurlOutput = Nothing And CurlError IsNot Nothing Then + Debug.WriteLine("CurlPost-E: " + CurlError) + Return CurlError + ElseIf CurlOutput IsNot Nothing And CurlError = Nothing Then + Debug.WriteLine("CurlPost-O: " + CurlOutput) + Return CurlOutput + ElseIf CurlOutput IsNot Nothing And CurlError IsNot Nothing Then + Debug.WriteLine("CurlPost-O: " + CurlOutput) + Return CurlOutput + Else + Debug.WriteLine("CurlPost-E: " + "curl: ") + Return CurlError + End If + + End Function + + + Public Function CurlAuthNew(ByVal Url As String, ByVal Cookies As String, ByVal Auth As String) As String + + + + Dim exepath As String = Path.Combine(Application.StartupPath, "lib", "curl.exe") + + Dim startinfo As New System.Diagnostics.ProcessStartInfo + Dim sr As StreamReader + Dim sr2 As StreamReader + + + + Dim cmd As String = "" + If Main.Curl_insecure = True Then + cmd = "--insecure " + End If + cmd = cmd + "--no-alpn -fsSLm 15 -A " + My.Resources.ffmpeg_user_agend.Replace("User-Agent: ", "") + Cookies + Auth + " " + Chr(34) + Url + Chr(34) + Dim Proc As New Process + 'MsgBox(cmd) + Dim CurlOutput As String = Nothing + Dim CurlError As String = Nothing + ' all parameters required to run the process + startinfo.FileName = exepath + startinfo.Arguments = cmd + startinfo.UseShellExecute = False + startinfo.WindowStyle = ProcessWindowStyle.Normal + startinfo.RedirectStandardError = True + startinfo.RedirectStandardOutput = True + startinfo.CreateNoWindow = True + startinfo.StandardOutputEncoding = Encoding.UTF8 + startinfo.StandardErrorEncoding = Encoding.UTF8 + Proc.StartInfo = startinfo + Proc.Start() ' start the process + sr = Proc.StandardOutput 'standard error is used by ffmpeg + sr2 = Proc.StandardError + 'sw = proc.StandardInput + + Dim start, finish, pau As Double + start = CSng(Microsoft.VisualBasic.DateAndTime.Timer) + pau = 5 + finish = start + pau + + Do + CurlOutput = CurlOutput + sr.ReadToEnd + CurlError = CurlError + sr2.ReadToEnd + 'ffmpegOutput2 = sr.ReadLine + 'Debug.WriteLine(CurlOutput) + + Loop Until Proc.HasExited Or Microsoft.VisualBasic.DateAndTime.Timer < finish + + + If CurlOutput = Nothing Or CBool(InStr(CurlOutput, "curl")) Then + Throw New System.Exception("Error - Getting ObjectJson data" + vbNewLine + CurlOutput) + Return Nothing + ElseIf CBool(InStr(CurlError, "curl")) Then + Throw New System.Exception("Error - Getting" + vbNewLine + CurlError) + Return Nothing + Else + Return CurlOutput + End If + + + End Function + + + + +#End Region + + + Function FindExistingVideo(ByVal rootPath As String, ByVal searchString As String, ByVal original As String) As String + Dim Tracks As Integer = 0 + Dim File As String = original + ' Durchsuchen aller Dateien im angegebenen Verzeichnis und seinen Unterverzeichnissen + For Each filePath As String In Directory.GetFiles(rootPath, "*", SearchOption.AllDirectories) + ' Überprüfen, ob der Dateiname den gesuchten Text enthält + If Path.GetFileName(filePath).Contains(searchString) Then + + If FFMPEG_Audio(filePath) > Tracks Then + File = filePath + End If + + End If + Next + + + Return File + End Function + + + + +End Module diff --git a/Crunchyroll Downloader/Main.vb b/Crunchyroll Downloader/Main.vb index a6d53ea..b934681 100644 --- a/Crunchyroll Downloader/Main.vb +++ b/Crunchyroll Downloader/Main.vb @@ -20,6 +20,7 @@ Imports Microsoft.Web.WebView2.Core Imports System.Net.Http Imports Crunchyroll_Downloader.CRD_Classes + Public Class Main Inherits MetroForm @@ -30,9 +31,6 @@ Public Class Main Public CheckCRLogin As Boolean = True - Public CR_SeasonJson As UrlJson = New UrlJson("", "") - Public CR_ObjectsJson As UrlJson = New UrlJson("", "") - Public CR_VideoJson As UrlJson = New UrlJson("", "") Public CR_AuthToken As String = "" Public CR_v1Token As String = "" @@ -774,218 +772,7 @@ Public Class Main End Function #End Region -#Region "curl" - Public Function Curl(ByVal Url As String) As String - - - - Dim exepath As String = Path.Combine(Application.StartupPath, "lib", "curl.exe") - - Dim startinfo As New System.Diagnostics.ProcessStartInfo - Dim sr As StreamReader - Dim sr2 As StreamReader - Dim cmd As String = "" - If Curl_insecure = True Then - cmd = "--insecure " - End If - cmd = cmd + "--no-alpn -fsSLm 15 -A " + My.Resources.ffmpeg_user_agend.Replace("User-Agent: ", "") + " " + Chr(34) + Url + Chr(34) - Dim Proc As New Process - 'MsgBox(cmd) - Dim CurlOutput As String = Nothing - Dim CurlError As String = Nothing - ' all parameters required to run the process - startinfo.FileName = exepath - startinfo.Arguments = cmd - startinfo.UseShellExecute = False - startinfo.WindowStyle = ProcessWindowStyle.Normal - startinfo.RedirectStandardError = True - startinfo.RedirectStandardOutput = True - startinfo.CreateNoWindow = True - startinfo.StandardOutputEncoding = Encoding.UTF8 - startinfo.StandardErrorEncoding = Encoding.UTF8 - Proc.StartInfo = startinfo - Proc.Start() ' start the process - sr = Proc.StandardOutput 'standard error is used by ffmpeg - sr2 = Proc.StandardError - 'sw = proc.StandardInput - - Dim start, finish, pau As Double - start = CSng(Microsoft.VisualBasic.DateAndTime.Timer) - pau = 5 - finish = start + pau - - Do - CurlOutput = CurlOutput + sr.ReadToEnd - CurlError = CurlError + sr2.ReadToEnd - 'ffmpegOutput2 = sr.ReadLine - 'Debug.WriteLine(CurlOutput) - - Loop Until Proc.HasExited Or Microsoft.VisualBasic.DateAndTime.Timer < finish - - - If CurlOutput = Nothing And CurlError = Nothing Then - Debug.WriteLine("curl-E: " + "curl: ") - Return CurlError - ElseIf CurlOutput = Nothing And CurlError IsNot Nothing Then - Debug.WriteLine("curl-E: " + CurlError) - Return CurlError - ElseIf CurlOutput IsNot Nothing And CurlError = Nothing Then - Debug.WriteLine("curl-O: " + CurlOutput) - Return CurlOutput - ElseIf CurlOutput IsNot Nothing And CurlError IsNot Nothing Then - Debug.WriteLine("curl-O: " + CurlOutput) - Return CurlOutput - Else - Debug.WriteLine("curl-E: " + "curl: ") - Return CurlError - End If - - - End Function - - Public Function CurlPost(ByVal Url As String, ByVal Cookies As String, ByVal Auth As String, ByVal Post As String) As String - - - Dim exepath As String = Path.Combine(Application.StartupPath, "lib", "curl.exe") - - Dim startinfo As New System.Diagnostics.ProcessStartInfo - Dim sr As StreamReader - Dim sr2 As StreamReader - - - Dim cmd As String = "" - If Curl_insecure = True Then - cmd = "--insecure " - End If - cmd = cmd + "--no-alpn -fsSLm 15 -A " + My.Resources.ffmpeg_user_agend.Replace("User-Agent: ", "") + Cookies + Auth + Post + " " + Chr(34) + Url + Chr(34) - Dim Proc As New Process - 'Debug.WriteLine("CurlPost: " + cmd) - Dim CurlOutput As String = Nothing - Dim CurlError As String = Nothing - ' all parameters required to run the process - startinfo.FileName = exepath - startinfo.Arguments = cmd - startinfo.UseShellExecute = False - startinfo.WindowStyle = ProcessWindowStyle.Normal - startinfo.RedirectStandardError = True - startinfo.RedirectStandardOutput = True - startinfo.CreateNoWindow = True - startinfo.StandardOutputEncoding = Encoding.UTF8 - startinfo.StandardErrorEncoding = Encoding.UTF8 - Proc.StartInfo = startinfo - Proc.Start() ' start the process - sr = Proc.StandardOutput 'standard error is used by ffmpeg - sr2 = Proc.StandardError - 'sw = proc.StandardInput - Dim start, finish, pau As Double - start = CSng(Microsoft.VisualBasic.DateAndTime.Timer) - pau = 5 - finish = start + pau - - Do - CurlOutput = CurlOutput + sr.ReadToEnd - CurlError = CurlError + sr2.ReadToEnd - 'ffmpegOutput2 = sr.ReadLine - 'Debug.WriteLine(CurlOutput) - - Loop Until Proc.HasExited Or Microsoft.VisualBasic.DateAndTime.Timer < finish - - - If CurlOutput = Nothing And CurlError = Nothing Then - Debug.WriteLine("CurlPost-E: " + "curl: ") - Return CurlError - ElseIf CurlOutput = Nothing And CurlError IsNot Nothing Then - Debug.WriteLine("CurlPost-E: " + CurlError) - Return CurlError - ElseIf CurlOutput IsNot Nothing And CurlError = Nothing Then - Debug.WriteLine("CurlPost-O: " + CurlOutput) - Return CurlOutput - ElseIf CurlOutput IsNot Nothing And CurlError IsNot Nothing Then - Debug.WriteLine("CurlPost-O: " + CurlOutput) - Return CurlOutput - Else - Debug.WriteLine("CurlPost-E: " + "curl: ") - Return CurlError - End If - - End Function - - - Public Function CurlAuth(ByVal Url As String, ByVal Cookies As String, ByVal Auth As String) As String - - - - Dim exepath As String = Path.Combine(Application.StartupPath, "lib", "curl.exe") - - Dim startinfo As New System.Diagnostics.ProcessStartInfo - Dim sr As StreamReader - Dim sr2 As StreamReader - - - - Dim cmd As String = "" - If Curl_insecure = True Then - cmd = "--insecure " - End If - cmd = cmd + "--no-alpn -fsSLm 15 -A " + My.Resources.ffmpeg_user_agend.Replace("User-Agent: ", "") + Cookies + Auth + " " + Chr(34) + Url + Chr(34) - Dim Proc As New Process - 'MsgBox(cmd) - Dim CurlOutput As String = Nothing - Dim CurlError As String = Nothing - ' all parameters required to run the process - startinfo.FileName = exepath - startinfo.Arguments = cmd - startinfo.UseShellExecute = False - startinfo.WindowStyle = ProcessWindowStyle.Normal - startinfo.RedirectStandardError = True - startinfo.RedirectStandardOutput = True - startinfo.CreateNoWindow = True - startinfo.StandardOutputEncoding = Encoding.UTF8 - startinfo.StandardErrorEncoding = Encoding.UTF8 - Proc.StartInfo = startinfo - Proc.Start() ' start the process - sr = Proc.StandardOutput 'standard error is used by ffmpeg - sr2 = Proc.StandardError - 'sw = proc.StandardInput - - Dim start, finish, pau As Double - start = CSng(Microsoft.VisualBasic.DateAndTime.Timer) - pau = 5 - finish = start + pau - - Do - CurlOutput = CurlOutput + sr.ReadToEnd - CurlError = CurlError + sr2.ReadToEnd - 'ffmpegOutput2 = sr.ReadLine - 'Debug.WriteLine(CurlOutput) - - Loop Until Proc.HasExited Or Microsoft.VisualBasic.DateAndTime.Timer < finish - - If CurlOutput = Nothing And CurlError = Nothing Then - Debug.WriteLine("CurlAuth-E: " + "curl: ") - Return CurlError - ElseIf CurlOutput = Nothing And CurlError IsNot Nothing Then - Debug.WriteLine("CurlAuth-E: " + CurlError) - Return CurlError - ElseIf CurlOutput IsNot Nothing And CurlError = Nothing Then - Debug.WriteLine("CurlAuth-O: " + CurlOutput) - Return CurlOutput - ElseIf CurlOutput IsNot Nothing And CurlError IsNot Nothing Then - Debug.WriteLine("CurlAuth-O: " + CurlOutput) - Return CurlOutput - Else - Debug.WriteLine("CurlAuth-E: " + "curl: ") - Return CurlError - End If - - - End Function - - - - -#End Region #Region "CR-Beta" @@ -1101,13 +888,20 @@ Public Class Main Dim Loc_CR_Cookies = " -H " + Chr(34) + CR_Cookies.Replace(Chr(34), "").Replace(" -H ", "") + Chr(34) - SeasonJson = CurlAuth(JsonUrl, Loc_CR_Cookies, Auth) + Try + + SeasonJson = CurlAuthNew(JsonUrl, Loc_CR_Cookies, Auth) + + Catch ex As Exception + If CBool(InStr(ex.ToString, "Error - Getting")) Then + MsgBox("Error invalid CR respone") + Exit Sub + Else + MsgBox("Error processing data") + Exit Sub + End If + End Try - If CBool(InStr(SeasonJson, "curl:")) = True Then - 'Browser.WebView2.CoreWebView2.Navigate(Url) - SetStatusLabel("Status: Critical error. #1091") - Exit Sub - End If Else @@ -1186,12 +980,12 @@ Public Class Main End Sub - Public Sub GetBetaVideoProxy(ByVal requesturl As String, ByVal AuthToken As String, ByVal WebsiteURL As String) - Dim Evaluator = New Thread(Sub() Me.GetBetaVideo(requesturl, AuthToken, WebsiteURL)) + Public Sub GetCRVideoProxy(ByVal requesturl As String, ByVal AuthToken As String, ByVal WebsiteURL As String) + Dim Evaluator = New Thread(Sub() Me.GetCRVideo(requesturl, AuthToken, WebsiteURL)) Evaluator.Start() End Sub - Public Sub GetBetaVideo(ByVal Streams As String, ByVal AuthToken As String, ByVal WebsiteURL As String) + Public Sub GetCRVideo(ByVal Streams As String, ByVal AuthToken As String, ByVal WebsiteURL As String) If b = False Then b = True End If @@ -1241,22 +1035,15 @@ Public Class Main Dim CR_EpisodeID As String = "" +#Region "No anime :(" + + If CBool(InStr(WebsiteURL, "musicvideo")) = True Then 'TextBox2_Text to bypasss name for now Dim ObjectsURL As String = Streams.Replace("music/", "music/music_videos/").Replace("/streams", "") - - ObjectJson = CurlAuth(ObjectsURL, Loc_CR_Cookies, Loc_AuthToken) - - 'MsgBox(ObjectsURL) - - 'MsgBox(ObjectJson.Length.ToString) - 'MsgBox(ObjectJson) - - 'title":" + " - - '"name":" + " + ObjectJson = CurlAuthNew(ObjectsURL, Loc_CR_Cookies, Loc_AuthToken) Dim Title() As String = ObjectJson.Split(New String() {Chr(34) + "title" + Chr(34) + ":" + Chr(34)}, System.StringSplitOptions.RemoveEmptyEntries) Dim Title2() As String = Title(1).Split(New String() {Chr(34)}, System.StringSplitOptions.RemoveEmptyEntries) @@ -1264,24 +1051,13 @@ Public Class Main Dim Arti() As String = ObjectJson.Split(New String() {Chr(34) + "name" + Chr(34) + ":" + Chr(34)}, System.StringSplitOptions.RemoveEmptyEntries) Dim Arti2() As String = Arti(1).Split(New String() {Chr(34)}, System.StringSplitOptions.RemoveEmptyEntries) - - 'MsgBox(Arti2(0)) - 'MsgBox(Title2(0)) - - TextBox2_Text = Arti2(0) + " - " + Title2(0) ElseIf CBool(InStr(WebsiteURL, "/concert/")) = True Then - 'TextBox2_Text to bypasss name for now - - 'https://www.crunchyroll.com/content/v2/music/MCB3E02384/streams?locale=de-DE - - 'https://www.crunchyroll.com/content/v2/music/concerts/MCB3E02384?locale=de-DE - Dim ObjectsURL As String = Streams.Replace("music/", "music/concerts/").Replace("/streams", "") - ObjectJson = CurlAuth(ObjectsURL, Loc_CR_Cookies, Loc_AuthToken) + ObjectJson = CurlAuthNew(ObjectsURL, Loc_CR_Cookies, Loc_AuthToken) Dim Title() As String = ObjectJson.Split(New String() {Chr(34) + "title" + Chr(34) + ":" + Chr(34)}, System.StringSplitOptions.RemoveEmptyEntries) @@ -1296,10 +1072,9 @@ Public Class Main TextBox2_Text = Arti2(0) + " - " + Title2(0) +#End Region Else - - Dim ObjectsURLBuilder() As String = Streams.Split(New String() {"videos"}, System.StringSplitOptions.RemoveEmptyEntries) Dim ObjectsURLBuilder2() As String = ObjectsURLBuilder(1).Split(New String() {"/streams"}, System.StringSplitOptions.RemoveEmptyEntries) Dim ObjectsURLBuilder3() As String = WebsiteURL.Split(New String() {"watch/"}, System.StringSplitOptions.RemoveEmptyEntries) @@ -1310,35 +1085,7 @@ Public Class Main Debug.WriteLine(ObjectsURL) - - ObjectJson = CurlAuth(ObjectsURL, Loc_CR_Cookies, Loc_AuthToken) - - - - 'ObjectJson = Curl(ObjectsURL) - - 'MsgBox(ObjectJson) - - If CBool(InStr(ObjectJson, "curl:")) = True Then - ObjectJson = CurlAuth(ObjectsURL, Loc_CR_Cookies, Loc_AuthToken) - End If - - - - If CBool(InStr(ObjectJson, "curl:")) = True And CBool(InStr(CR_ObjectsJson.Url, ObjectsURLBuilder4(0))) Then - Debug.WriteLine("curl error, using CR_ObjectsJson " + vbNewLine + ObjectJson) - - ObjectJson = CR_ObjectsJson.Content - CR_ObjectsJson = New UrlJson("", "") - ElseIf CBool(InStr(ObjectJson, "curl:")) Then - - Throw New System.Exception("Error - Getting ObjectJson data" + vbNewLine + ObjectJson) - - 'MsgBox("Error - Getting ObjectJson data" + vbNewLine + ObjectJson) - 'Exit Sub - End If - - + ObjectJson = CurlAuthNew(ObjectsURL, Loc_CR_Cookies, Loc_AuthToken) 'Filter JSON esqaped characters 'Debug.WriteLine(Date.Now.ToString + "before:" + ObjectJson) @@ -1394,22 +1141,8 @@ Public Class Main #Region "VideoJson" Dim VideoJson As String = Nothing - VideoJson = CurlAuth(Streams, Loc_CR_Cookies, Loc_AuthToken) - If CBool(InStr(VideoJson, "curl:")) = True Then - VideoJson = CurlAuth(Streams, Loc_CR_Cookies, Loc_AuthToken) - - End If - - If CBool(InStr(VideoJson, "curl:")) = True Then 'And CBool(InStr(CR_VideoJson.Url, StreamsUrlBuilder2(0))) Then - Debug.WriteLine("curl error, using CR_VideoJson " + vbNewLine + VideoJson) - VideoJson = CR_VideoJson.Content - CR_VideoJson = New UrlJson("", "") - ElseIf CBool(InStr(VideoJson, "curl:")) = True Then - Throw New System.Exception("Error - Getting VideoJson data" + vbNewLine + VideoJson) 'VideoJson = Nothing - ' MsgBox("Error - Getting VideoJson data" + vbNewLine + VideoJson) - ' Exit Sub - End If + VideoJson = CurlAuthNew(Streams, Loc_CR_Cookies, Loc_AuthToken) Debug.WriteLine("VideoJson: " + VideoJson) Debug.WriteLine("VideoStreams: " + Streams) @@ -1447,17 +1180,11 @@ Public Class Main 'MsgBox(Streams) - VideoJson = CurlAuth(Streams, Loc_CR_Cookies, Loc_AuthToken) - If CBool(InStr(VideoJson, "curl:")) = True Then - VideoJson = CurlAuth(Streams, Loc_CR_Cookies, Loc_AuthToken) - Else - Exit For - End If - If CBool(InStr(VideoJson, "curl:")) = True Then - Throw New System.Exception("Error - Getting VideoJson data" + vbNewLine + VideoJson) - End If + + VideoJson = CurlAuthNew(Streams, Loc_CR_Cookies, Loc_AuthToken) + End If @@ -1597,6 +1324,7 @@ Public Class Main #Region "Name von Crunchyroll" + Dim MergeSearch As String = "if not changed no Merch possible, i hope..." If CR_episode = Nothing Or CR_episode = "" And CR_episode2 = Nothing Then CR_episode_int = "0" @@ -1657,10 +1385,13 @@ Public Class Main If NameParts(i) = "AnimeTitle" Then CR_FilenName = CR_FilenName + " " + CR_series_title + MergeSearch = MergeSearch + " " + CR_series_title ElseIf NameParts(i) = "Season" Then CR_FilenName = CR_FilenName + " " + CR_season_number + MergeSearch = MergeSearch + " " + CR_season_number ElseIf NameParts(i) = "EpisodeNR" Then CR_FilenName = CR_FilenName + " " + CR_episode + MergeSearch = MergeSearch + " " + CR_episode ElseIf NameParts(i) = "EpisodeName" Then CR_FilenName = CR_FilenName + " " + CR_title ElseIf NameParts(i) = "AnimeDub" Then @@ -1823,6 +1554,13 @@ Public Class Main Dim Pfad6 As String = Pfad5 Dim MergeAudio As Boolean = False + If DownloadScope = DownloadScopeEnum.MergeAudio Then + + Pfad5 = FindExistingVideo(Path.GetDirectoryName(Pfad5), MergeSearch, Pfad5) + + End If + ' + If My.Computer.FileSystem.FileExists(Pfad5) And DownloadScope = DownloadScopeEnum.OldDefault Then 'Pfad = Kompeltter Pfad mit Dateinamen + ENdung Me.Invoke(New Action(Function() As Object Anime_Add.StatusLabel.Text = "Status: The file already exists." @@ -1847,6 +1585,8 @@ Public Class Main FileSystem.Rename(Pfad5, Pfad6) MergeAudio = True + + ElseIf My.Computer.FileSystem.FileExists(Path.GetDirectoryName(Pfad5) + "\" + Path.GetFileNameWithoutExtension(Pfad5) + "aac") And DownloadScope = DownloadScopeEnum.AudioOnly Then Me.Invoke(New Action(Function() As Object @@ -2304,14 +2044,22 @@ Public Class Main Catch ex As Exception End Try If KeepCache = False Then + + + Dim folderPath As String = Pfad + Dim files() As String = Directory.GetFiles(folderPath, "*", SearchOption.AllDirectories) + + For Each file As String In files + If CBool(InStr(file, "CRD-Temp-File-")) Then + 'MsgBox(file) + System.IO.File.Delete(file) + End If + Next Try Dim di As New System.IO.DirectoryInfo(Pfad) For Each fi As System.IO.DirectoryInfo In di.EnumerateDirectories("*.*", System.IO.SearchOption.TopDirectoryOnly) - If fi.Attributes.HasFlag(System.IO.FileAttributes.Hidden) Then - Else - If CBool(InStr(fi.Name, "CRD-Temp-File-")) Then - System.IO.Directory.Delete(fi.FullName, True) - End If + If CBool(InStr(fi.Name, "CRD-Temp-File-")) Then + System.IO.Directory.Delete(fi.FullName, True) End If Next Catch ex As Exception @@ -3747,7 +3495,7 @@ Public Class Main End If Me.Text = "Status: Crunchyroll episode found." Debug.WriteLine("Crunchyroll episode found") - GetBetaVideoProxy(Request.Uri, CR_AuthToken, WebbrowserURL) + GetCRVideoProxy(Request.Uri, CR_AuthToken, WebbrowserURL) b = True LoadedUrls.Clear() Me.Text = "Crunchyroll Downloader" @@ -3789,66 +3537,6 @@ Public Class Main Me.Text = "Crunchyroll Downloader" Exit Sub End If - ElseIf CBool(InStr(Request.Uri, "crunchyroll.com/")) And CBool(InStr(Request.Uri, "/objects/")) Then - If i = LoadedUrls.Count - 1 And SavedObjectsUrl IsNot "" Then - - If b = False Then - Dim ObjectJson As String - Dim ObjectsUrl As String = Request.Uri - Dim StreamsUrl As String - ObjectJson = Curl(ObjectsUrl) - - If CBool(InStr(ObjectJson, "curl:")) = True Then - ObjectJson = Curl(ObjectsUrl) - End If - - If CBool(InStr(ObjectJson, "curl:")) = True Then - Continue For - ElseIf CBool(InStr(ObjectJson, "videos/")) = False Then - - If Application.OpenForms().OfType(Of Anime_Add).Any = True Then - Anime_Add.StatusLabel.Text = "Status: Failed, check CR login" - End If - Me.Text = "Status: Failed, check CR login" - Debug.WriteLine("Status: Failed, check CR login") - - Continue For - End If - - - - - Dim StreamsUrlBuilder() As String = ObjectJson.Split(New String() {"videos/"}, System.StringSplitOptions.RemoveEmptyEntries) - Dim StreamsUrlBuilder2() As String = StreamsUrlBuilder(1).Split(New String() {"/streams"}, System.StringSplitOptions.RemoveEmptyEntries) - - Dim StreamsUrlBuilder3() As String = ObjectsUrl.Split(New String() {"objects/"}, System.StringSplitOptions.RemoveEmptyEntries) - Dim StreamsUrlBuilder4() As String = StreamsUrlBuilder3(1).Split(New String() {"?"}, System.StringSplitOptions.RemoveEmptyEntries) - - StreamsUrl = StreamsUrlBuilder3(0) + "videos/" + StreamsUrlBuilder2(0) + "/streams?" + StreamsUrlBuilder4(1) - - - If Application.OpenForms().OfType(Of Anime_Add).Any = True Then - Anime_Add.StatusLabel.Text = "Status: Crunchyroll episode found." - End If - Me.Text = "Status: Crunchyroll episode found." - Debug.WriteLine("Crunchyroll episode found") - Dim Headers As New List(Of KeyValuePair(Of String, String)) - Headers.AddRange(Request.Headers.ToList) - Dim AuthToken As String = "" - For ii As Integer = 0 To Headers.Count - If CBool(InStr(Headers.Item(i).Value, "Bearer")) Then - AuthToken = Headers.Item(i).Value - End If - Next - GetBetaVideoProxy(StreamsUrl, AuthToken, WebbrowserURL) - b = True - LoadedUrls.Clear() - Me.Text = "Crunchyroll Downloader" - Exit Sub - End If - Else - SavedObjectsUrl = Request.Uri - End If End If @@ -4480,13 +4168,7 @@ Public Class Main 'MsgBox(CR_Cookies) End Sub - Private Sub ClearAllSettingsToolStripMenuItem_Click(sender As Object, e As EventArgs) Handles UrlJsonsToolStripMenuItem.Click - MsgBox("Season" + vbNewLine + CR_SeasonJson.Content.Count.ToString) - MsgBox("Object" + vbNewLine + CR_ObjectsJson.Content.Count.ToString) - MsgBox("Streams" + vbNewLine + CR_VideoJson.Content.Count.ToString) - - End Sub Private Sub ItemBoundsToolStripMenuItem_Click(sender As Object, e As EventArgs) @@ -4798,7 +4480,22 @@ Public Class Main Dim StreamsUrl As String = Nothing Dim ObjectJson As String - ObjectJson = CurlAuth(ObjectsUrl, Loc_CR_Cookies, Auth2) + + + + Try + + ObjectJson = CurlAuthNew(ObjectsUrl, Loc_CR_Cookies, Auth2) + + Catch ex As Exception + If CBool(InStr(ex.ToString, "Error - Getting")) Then + MsgBox("Error invalid CR respone") + Exit Sub + Else + MsgBox("Error processing data") + Exit Sub + End If + End Try If CBool(InStr(ObjectJson, "curl:")) = True Then @@ -4831,7 +4528,7 @@ Public Class Main Exit Sub End Try - GetBetaVideoProxy(StreamsUrl, Auth2, url) + GetCRVideoProxy(StreamsUrl, Auth2, url) Else