diff --git a/.vs/Crunchyroll Downloader/v17/.suo b/.vs/Crunchyroll Downloader/v17/.suo index 608f2d9..33d5689 100644 Binary files a/.vs/Crunchyroll Downloader/v17/.suo and b/.vs/Crunchyroll Downloader/v17/.suo differ diff --git a/Crunchyroll Downloader/Anime_Add.vb b/Crunchyroll Downloader/Anime_Add.vb index fcdc2ad..4db4486 100644 --- a/Crunchyroll Downloader/Anime_Add.vb +++ b/Crunchyroll Downloader/Anime_Add.vb @@ -27,7 +27,7 @@ Public Class Anime_Add 'Main.LoadedUrl = Url - Dim locale As String = "en-US" + If CBool(InStr(Url, "crunchyroll.com")) = True And CBool(InStr(Url, "watch")) = True And CBool(Main.CrBetaBasic = Nothing) = False Then #Region "Get Cookies" Main.CR_Cookies = "Cookie: " @@ -47,23 +47,37 @@ Public Class Anime_Add Main.CR_Cookies = Main.CR_Cookies + list.Item(i).Name + "=" + list.Item(i).Value + ";" End If If CBool(InStr(list.Item(i).Domain, ".crunchyroll.com")) And CBool(InStr(list.Item(i).Name, "c_locale")) Then - locale = list.Item(i).Value + Main.locale = list.Item(i).Value End If - If CBool(InStr(list.Item(i).Domain, ".crunchyroll.com")) = True And CBool(InStr(list.Item(i).Name, "etp_rt")) = True And Main.CheckCRLogin = True And Main.CR_etp_rt = Nothing Then - Debug.WriteLine("etp_rt = True") - etp_rt = True - Main.CR_etp_rt = list.Item(i).Value - rk.SetValue("etp_rt", Main.CR_etp_rt, RegistryValueKind.String) - ElseIf CBool(InStr(list.Item(i).Domain, ".crunchyroll.com")) = True And CBool(InStr(list.Item(i).Name, "__cf_bm")) = True = True And Main.CheckCRLogin = True And Main.CR_ajs_user_id = Nothing Then - 'MsgBox(list.Item(i).Value) - Debug.WriteLine("ajs_user_id = True") - ajs_user_id = True - Main.CR_ajs_user_id = list.Item(i).Value - rk.SetValue("ajs_user_id", Main.CR_ajs_user_id, RegistryValueKind.String) - End If + 'If CBool(InStr(list.Item(i).Domain, ".crunchyroll.com")) = True And CBool(InStr(list.Item(i).Name, "etp_rt")) = True And Main.CheckCRLogin = True And Main.CR_etp_rt = Nothing Then + ' Debug.WriteLine("etp_rt = True") + ' etp_rt = True + ' Main.CR_etp_rt = list.Item(i).Value + ' rk.SetValue("etp_rt", Main.CR_etp_rt, RegistryValueKind.String) + 'ElseIf CBool(InStr(list.Item(i).Domain, ".crunchyroll.com")) = True And CBool(InStr(list.Item(i).Name, "__cf_bm")) = True = True And Main.CheckCRLogin = True And Main.CR_ajs_user_id = Nothing Then + ' 'MsgBox(list.Item(i).Value) + ' Debug.WriteLine("ajs_user_id = True") + ' ajs_user_id = True + ' Main.CR_ajs_user_id = list.Item(i).Value + ' rk.SetValue("ajs_user_id", Main.CR_ajs_user_id, RegistryValueKind.String) + 'End If Next + 'If Main.locale = Nothing Then + Dim locale1() As String = Url.Split(New String() {"crunchyroll.com/"}, System.StringSplitOptions.RemoveEmptyEntries) + Dim locale2() As String = locale1(1).Split(New String() {"/watch"}, System.StringSplitOptions.RemoveEmptyEntries) + 'MsgBox(locale2(0)) + Main.locale = Main.Convert_locale(locale2(0)) + 'End If + + 'MsgBox(Main.locale) + + If Main.locale = Nothing Then + + CefSharp_Browser.WebBrowser1.Load(Url) + Exit Sub + End If 'If Main.CR_etp_rt IsNot Nothing And etp_rt = False Then @@ -124,17 +138,17 @@ Public Class Anime_Add Dim ObjectsUrl As String = Nothing - Try - 'Using client As New WebClient() - ' client.Encoding = System.Text.Encoding.UTF8 - ' client.Headers.Add(My.Resources.ffmpeg_user_agend.Replace(Chr(34), "")) - ' client.Headers.Add("ACCEPT: application/json, text/javascript, */*; q=0.01") - ' client.Headers.Add("Accept-Encoding: identity") - ' client.Headers.Add("Referer: " + Url) - ' client.Headers.Add("Authorization: " + CRBetaBearer) - ' client.Headers.Add(Cookies) '+ WebBrowser1.Document.Cookie) - 'MsgBox(OmUStreamSplitEpisodeIndex(1)) - Dim Auth2 As String = " -H " + Chr(34) + "Authorization: " + CRBetaBearer + Chr(34) + 'Try + 'Using client As New WebClient() + ' client.Encoding = System.Text.Encoding.UTF8 + ' client.Headers.Add(My.Resources.ffmpeg_user_agend.Replace(Chr(34), "")) + ' client.Headers.Add("ACCEPT: application/json, text/javascript, */*; q=0.01") + ' client.Headers.Add("Accept-Encoding: identity") + ' client.Headers.Add("Referer: " + Url) + ' client.Headers.Add("Authorization: " + CRBetaBearer) + ' client.Headers.Add(Cookies) '+ WebBrowser1.Document.Cookie) + 'MsgBox(OmUStreamSplitEpisodeIndex(1)) + Dim Auth2 As String = " -H " + Chr(34) + "Authorization: " + CRBetaBearer + Chr(34) Dim v2Content As String = Main.CurlAuth("https://www.crunchyroll.com/index/v2", Main.CR_Cookies, Auth2) 'client.DownloadString("https://www.crunchyroll.com/index/v2") 'Debug.WriteLine(v2Content) 'MsgBox("v2: " + v2Content) @@ -168,19 +182,20 @@ Public Class Anime_Add Dim ObjectsURLBuilder4() As String = ObjectsURLBuilder3(1).Split(New String() {"/"}, System.StringSplitOptions.RemoveEmptyEntries) - ObjectsUrl = "https://www.crunchyroll.com/cms/v2" + bucket2(0) + "/objects/" + ObjectsURLBuilder4(0) + "?locale=" + locale + "&Signature=" + signature2(0) + "&Policy=" + policy2(0) + "&Key-Pair-Id=" + key_pair_id2(0) - 'End Using + ObjectsUrl = "https://www.crunchyroll.com/cms/v2" + bucket2(0) + "/objects/" + ObjectsURLBuilder4(0) + "?locale=" + Main.locale + "&Signature=" + signature2(0) + "&Policy=" + policy2(0) + "&Key-Pair-Id=" + key_pair_id2(0) + 'End Using + 'MsgBox(ObjectsUrl) + + Debug.WriteLine("ObjectsUrl: " + ObjectsUrl) - Debug.WriteLine("ObjectsUrl: " + ObjectsUrl) + 'Catch ex As Exception + ' MsgBox(ex.ToString) + ' CefSharp_Browser.WebBrowser1.Load(Url) + ' Exit Sub + 'End Try - - Catch ex As Exception - CefSharp_Browser.WebBrowser1.Load(Url) - Exit Sub - End Try - - Dim StreamsUrl As String = Nothing + Dim StreamsUrl As String = Nothing Dim ObjectJson As String Try ObjectJson = Main.Curl(ObjectsUrl) diff --git a/Crunchyroll Downloader/CefSharp_Browser.vb b/Crunchyroll Downloader/CefSharp_Browser.vb index ddeaddb..4c9a031 100644 --- a/Crunchyroll Downloader/CefSharp_Browser.vb +++ b/Crunchyroll Downloader/CefSharp_Browser.vb @@ -365,6 +365,15 @@ Public Class CefSharp_Browser Exit Sub End If Debug.WriteLine(e.Request.Url) + ElseIf CBool(InStr(e.Request.Url, "crunchyroll.com/")) And CBool(InStr(e.Request.Url, "/objects/")) Then + If (Me.InvokeRequired) Then + Me.Invoke(Sub() Main.LoadedUrls.Add(e.Request.Url)) + Exit Sub + Else + Main.LoadedUrls.Add(e.Request.Url) + Exit Sub + End If + Debug.WriteLine(e.Request.Url) ElseIf CBool(InStr(e.Request.Url, "crunchyroll.com/")) And CBool(InStr(e.Request.Url, "seasons?series_id=")) Then If (Me.InvokeRequired) Then Me.Invoke(Sub() Main.LoadedUrls.Add(e.Request.Url)) diff --git a/Crunchyroll Downloader/Main.vb b/Crunchyroll Downloader/Main.vb index 65c2f8e..050939a 100644 --- a/Crunchyroll Downloader/Main.vb +++ b/Crunchyroll Downloader/Main.vb @@ -33,7 +33,7 @@ Public Class Main Public CrBetaMassParameters As String = Nothing Public CrBetaMassBaseURL As String = Nothing Public CrBetaBasic As String = Nothing - + Public locale As String = Nothing 'Public CrBetaObjects As String = Nothing 'Public CrBetaStreams As String = Nothing 'Public CrBetaStreamsUrl As String = Nothing @@ -1033,7 +1033,7 @@ Public Class Main 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) + 'MsgBox(cmd) Dim CurlOutput As String = Nothing Dim CurlError As String = Nothing ' all parameters required to run the process @@ -1044,6 +1044,8 @@ Public Class Main 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 @@ -1099,6 +1101,8 @@ Public Class Main 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 @@ -1156,6 +1160,8 @@ Public Class Main 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 @@ -1390,6 +1396,8 @@ Public Class Main ObjectJson = Curl(ObjectsURL) + 'MsgBox(ObjectJson) + If CBool(InStr(ObjectJson, "curl:")) = True Then ObjectJson = Curl(ObjectsURL) End If @@ -1782,9 +1790,15 @@ Public Class Main Dim SoftSub_2 As String() = SoftSub(1).Split(New [Char]() {Chr(34)}) Dim SoftSub_3 As String = SoftSub_2(0).Replace("&", "&").Replace("/u0026", "&").Replace("\u002F", "/").Replace("\u0026", "&") 'MsgBox(SoftSub_3) - Dim client0 As New WebClient - client0.Encoding = Encoding.UTF8 - Dim str0 As String = client0.DownloadString(SoftSub_3) 'Curl(SoftSub_3) + Dim str0 As String = Nothing + If System.Environment.OSVersion.Version.Major < 10 Then + str0 = Curl(SoftSub_3) + Else + Dim client0 As New WebClient + client0.Encoding = Encoding.UTF8 + str0 = client0.DownloadString(SoftSub_3) 'Curl(SoftSub_3) + End If + 'MsgBox(str0) Dim Pfad3 As String = Pfad2.Replace(Chr(34), "") Dim FN As String = Path.ChangeExtension(Path.Combine(Path.GetFileNameWithoutExtension(Pfad3) + "." + GetSubFileLangName(SoftSubs2(i)) + Path.GetExtension(Pfad3)), "ass") @@ -1950,10 +1964,17 @@ Public Class Main End If 'MsgBox(URL_DL) Else - Dim client As New System.Net.WebClient - client.Encoding = Encoding.UTF8 - 'MsgBox(CR_URI_Master) - Dim str As String = client.DownloadString(CR_URI_Master) + + Dim str As String = Nothing + + If System.Environment.OSVersion.Version.Major < 10 Then + str = Curl(CR_URI_Master) + Else + Dim client As New System.Net.WebClient + client.Encoding = Encoding.UTF8 + str = client.DownloadString(CR_URI_Master) + End If + 'MsgBox(str) If CBool(InStr(str, "x" + Reso.ToString + ",")) Then Reso2 = "x" + Reso.ToString @@ -2076,6 +2097,35 @@ Public Class Main End Try End Sub + Function Convert_locale(ByVal locale As String) As String + Try + If locale = "de" Then + Return "de-DE" + ElseIf locale = "" Then + Return "en-US" + ElseIf locale = "pt-br" Then + Return "pt-BR" + ElseIf locale = "es" Then + Return "es-419" + ElseIf locale = "fr" Then + Return "fr-FR" + ElseIf locale = "ar" Then + Return "ar-SA" + ElseIf locale = "ru" Then + Return "ru-RU" + ElseIf locale = "it" Then + Return "it-IT" + ElseIf locale = "es-es" Then + Return "es-ES" + ElseIf locale = "pt-pt" Then + Return "pt-PT" + Else + Return CB_SuB_Nothing + End If + Catch ex As Exception + Return Nothing + End Try + End Function Function ConvertCC(ByVal CC As String) As String Try If CC = "deDE" Then @@ -2344,6 +2394,8 @@ Public Class Main startinfo.RedirectStandardError = True startinfo.RedirectStandardOutput = True startinfo.CreateNoWindow = True + startinfo.StandardOutputEncoding = Encoding.UTF8 + startinfo.StandardErrorEncoding = Encoding.UTF8 AddHandler proc.ErrorDataReceived, AddressOf FFMPEGResoBack AddHandler proc.OutputDataReceived, AddressOf FFMPEGResoBack proc.StartInfo = startinfo @@ -3631,6 +3683,44 @@ Public Class Main 'CefSharp_Browser.WebBrowser1.LoadUrl(requesturl) + LoadedUrls.Clear() + Me.Text = "Crunchyroll Downloader" + Exit Sub + End If + ElseIf CBool(InStr(requesturl, "crunchyroll.com/")) And CBool(InStr(requesturl, "/objects/")) Then + + If b = False Then + Dim ObjectJson As String + Dim ObjectsUrl As String = requesturl + 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 + 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") + GetBetaVideoProxy(StreamsUrl, WebbrowserURL) + b = True LoadedUrls.Clear() Me.Text = "Crunchyroll Downloader" Exit Sub diff --git a/Crunchyroll Downloader/My Project/AssemblyInfo.vb b/Crunchyroll Downloader/My Project/AssemblyInfo.vb index e97ef51..e2b3705 100644 --- a/Crunchyroll Downloader/My Project/AssemblyInfo.vb +++ b/Crunchyroll Downloader/My Project/AssemblyInfo.vb @@ -32,6 +32,6 @@ Imports System.Runtime.InteropServices ' übernehmen, indem Sie "*" eingeben: ' - - + + diff --git a/Crunchyroll Downloader/einstellungen.vb b/Crunchyroll Downloader/einstellungen.vb index 0a132ea..00cf3a2 100644 --- a/Crunchyroll Downloader/einstellungen.vb +++ b/Crunchyroll Downloader/einstellungen.vb @@ -917,7 +917,7 @@ Public Class Einstellungen - Private Sub ListC1_Click(sender As Object, e As EventArgs) Handles ListC1.Click, ListC2.Click, ListC3.Click, ListC4.Click, ListC5.Click, ListC6.Click, ListC7.Click + Private Sub ListC1_Click(sender As Object, e As EventArgs) Handles ListC1.Click, ListC2.Click, ListC3.Click, ListC4.Click, ListC5.Click, ListC6.Click, ListC7.Click, ListC8.Click, ListC9.Click Dim Button As ToolStripMenuItem = CType(sender, ToolStripMenuItem) If Button.Text = "-c copy" Then FFMPEG_CommandP1.Text = "-c copy" @@ -1327,6 +1327,7 @@ Public Class Einstellungen + #End Region