improvements

fix not selectable qsv (Intel iGPU; Intel Arc) encoder options
fix encoding for curl #568
added theoretical workaround for  "SSL/TLS secure channel" on windows 8 and 8.1
added trigger for objects json
changed locale value to be taken from input url
This commit is contained in:
hama3254 2022-10-27 17:23:57 +02:00
parent 6d96f606a3
commit c1494366f2
6 changed files with 162 additions and 47 deletions

Binary file not shown.

View File

@ -27,7 +27,7 @@ Public Class Anime_Add
'Main.LoadedUrl = Url '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 If CBool(InStr(Url, "crunchyroll.com")) = True And CBool(InStr(Url, "watch")) = True And CBool(Main.CrBetaBasic = Nothing) = False Then
#Region "Get Cookies" #Region "Get Cookies"
Main.CR_Cookies = "Cookie: " 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 + ";" Main.CR_Cookies = Main.CR_Cookies + list.Item(i).Name + "=" + list.Item(i).Value + ";"
End If End If
If CBool(InStr(list.Item(i).Domain, ".crunchyroll.com")) And CBool(InStr(list.Item(i).Name, "c_locale")) Then 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 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 '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") ' Debug.WriteLine("etp_rt = True")
etp_rt = True ' etp_rt = True
Main.CR_etp_rt = list.Item(i).Value ' Main.CR_etp_rt = list.Item(i).Value
rk.SetValue("etp_rt", Main.CR_etp_rt, RegistryValueKind.String) ' 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 '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) ' 'MsgBox(list.Item(i).Value)
Debug.WriteLine("ajs_user_id = True") ' Debug.WriteLine("ajs_user_id = True")
ajs_user_id = True ' ajs_user_id = True
Main.CR_ajs_user_id = list.Item(i).Value ' Main.CR_ajs_user_id = list.Item(i).Value
rk.SetValue("ajs_user_id", Main.CR_ajs_user_id, RegistryValueKind.String) ' rk.SetValue("ajs_user_id", Main.CR_ajs_user_id, RegistryValueKind.String)
End If 'End If
Next 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 'If Main.CR_etp_rt IsNot Nothing And etp_rt = False Then
@ -124,7 +138,7 @@ Public Class Anime_Add
Dim ObjectsUrl As String = Nothing Dim ObjectsUrl As String = Nothing
Try 'Try
'Using client As New WebClient() 'Using client As New WebClient()
' client.Encoding = System.Text.Encoding.UTF8 ' client.Encoding = System.Text.Encoding.UTF8
' client.Headers.Add(My.Resources.ffmpeg_user_agend.Replace(Chr(34), "")) ' client.Headers.Add(My.Resources.ffmpeg_user_agend.Replace(Chr(34), ""))
@ -168,17 +182,18 @@ Public Class Anime_Add
Dim ObjectsURLBuilder4() As String = ObjectsURLBuilder3(1).Split(New String() {"/"}, System.StringSplitOptions.RemoveEmptyEntries) 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) 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 'End Using
'MsgBox(ObjectsUrl)
Debug.WriteLine("ObjectsUrl: " + ObjectsUrl) Debug.WriteLine("ObjectsUrl: " + ObjectsUrl)
Catch ex As Exception 'Catch ex As Exception
CefSharp_Browser.WebBrowser1.Load(Url) ' MsgBox(ex.ToString)
Exit Sub ' CefSharp_Browser.WebBrowser1.Load(Url)
End Try ' Exit Sub
'End Try
Dim StreamsUrl As String = Nothing Dim StreamsUrl As String = Nothing
Dim ObjectJson As String Dim ObjectJson As String

View File

@ -365,6 +365,15 @@ Public Class CefSharp_Browser
Exit Sub Exit Sub
End If End If
Debug.WriteLine(e.Request.Url) 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 ElseIf CBool(InStr(e.Request.Url, "crunchyroll.com/")) And CBool(InStr(e.Request.Url, "seasons?series_id=")) Then
If (Me.InvokeRequired) Then If (Me.InvokeRequired) Then
Me.Invoke(Sub() Main.LoadedUrls.Add(e.Request.Url)) Me.Invoke(Sub() Main.LoadedUrls.Add(e.Request.Url))

View File

@ -33,7 +33,7 @@ Public Class Main
Public CrBetaMassParameters As String = Nothing Public CrBetaMassParameters As String = Nothing
Public CrBetaMassBaseURL As String = Nothing Public CrBetaMassBaseURL As String = Nothing
Public CrBetaBasic As String = Nothing Public CrBetaBasic As String = Nothing
Public locale As String = Nothing
'Public CrBetaObjects As String = Nothing 'Public CrBetaObjects As String = Nothing
'Public CrBetaStreams As String = Nothing 'Public CrBetaStreams As String = Nothing
'Public CrBetaStreamsUrl As String = Nothing 'Public CrBetaStreamsUrl As String = Nothing
@ -1033,7 +1033,7 @@ Public Class Main
End If End If
cmd = cmd + "--no-alpn -fsSLm 15 -A " + My.Resources.ffmpeg_user_agend.Replace("User-Agent: ", "") + " " + Chr(34) + Url + Chr(34) 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 Dim Proc As New Process
MsgBox(cmd) 'MsgBox(cmd)
Dim CurlOutput As String = Nothing Dim CurlOutput As String = Nothing
Dim CurlError As String = Nothing Dim CurlError As String = Nothing
' all parameters required to run the process ' all parameters required to run the process
@ -1044,6 +1044,8 @@ Public Class Main
startinfo.RedirectStandardError = True startinfo.RedirectStandardError = True
startinfo.RedirectStandardOutput = True startinfo.RedirectStandardOutput = True
startinfo.CreateNoWindow = True startinfo.CreateNoWindow = True
startinfo.StandardOutputEncoding = Encoding.UTF8
startinfo.StandardErrorEncoding = Encoding.UTF8
Proc.StartInfo = startinfo Proc.StartInfo = startinfo
Proc.Start() ' start the process Proc.Start() ' start the process
sr = Proc.StandardOutput 'standard error is used by ffmpeg sr = Proc.StandardOutput 'standard error is used by ffmpeg
@ -1099,6 +1101,8 @@ Public Class Main
startinfo.RedirectStandardError = True startinfo.RedirectStandardError = True
startinfo.RedirectStandardOutput = True startinfo.RedirectStandardOutput = True
startinfo.CreateNoWindow = True startinfo.CreateNoWindow = True
startinfo.StandardOutputEncoding = Encoding.UTF8
startinfo.StandardErrorEncoding = Encoding.UTF8
Proc.StartInfo = startinfo Proc.StartInfo = startinfo
Proc.Start() ' start the process Proc.Start() ' start the process
sr = Proc.StandardOutput 'standard error is used by ffmpeg sr = Proc.StandardOutput 'standard error is used by ffmpeg
@ -1156,6 +1160,8 @@ Public Class Main
startinfo.RedirectStandardError = True startinfo.RedirectStandardError = True
startinfo.RedirectStandardOutput = True startinfo.RedirectStandardOutput = True
startinfo.CreateNoWindow = True startinfo.CreateNoWindow = True
startinfo.StandardOutputEncoding = Encoding.UTF8
startinfo.StandardErrorEncoding = Encoding.UTF8
Proc.StartInfo = startinfo Proc.StartInfo = startinfo
Proc.Start() ' start the process Proc.Start() ' start the process
sr = Proc.StandardOutput 'standard error is used by ffmpeg sr = Proc.StandardOutput 'standard error is used by ffmpeg
@ -1390,6 +1396,8 @@ Public Class Main
ObjectJson = Curl(ObjectsURL) ObjectJson = Curl(ObjectsURL)
'MsgBox(ObjectJson)
If CBool(InStr(ObjectJson, "curl:")) = True Then If CBool(InStr(ObjectJson, "curl:")) = True Then
ObjectJson = Curl(ObjectsURL) ObjectJson = Curl(ObjectsURL)
End If End If
@ -1782,9 +1790,15 @@ Public Class Main
Dim SoftSub_2 As String() = SoftSub(1).Split(New [Char]() {Chr(34)}) 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", "&") Dim SoftSub_3 As String = SoftSub_2(0).Replace("&", "&").Replace("/u0026", "&").Replace("\u002F", "/").Replace("\u0026", "&")
'MsgBox(SoftSub_3) 'MsgBox(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 Dim client0 As New WebClient
client0.Encoding = Encoding.UTF8 client0.Encoding = Encoding.UTF8
Dim str0 As String = client0.DownloadString(SoftSub_3) 'Curl(SoftSub_3) str0 = client0.DownloadString(SoftSub_3) 'Curl(SoftSub_3)
End If
'MsgBox(str0) 'MsgBox(str0)
Dim Pfad3 As String = Pfad2.Replace(Chr(34), "") 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") 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 End If
'MsgBox(URL_DL) 'MsgBox(URL_DL)
Else Else
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 Dim client As New System.Net.WebClient
client.Encoding = Encoding.UTF8 client.Encoding = Encoding.UTF8
'MsgBox(CR_URI_Master) str = client.DownloadString(CR_URI_Master)
Dim str As String = client.DownloadString(CR_URI_Master) End If
'MsgBox(str) 'MsgBox(str)
If CBool(InStr(str, "x" + Reso.ToString + ",")) Then If CBool(InStr(str, "x" + Reso.ToString + ",")) Then
Reso2 = "x" + Reso.ToString Reso2 = "x" + Reso.ToString
@ -2076,6 +2097,35 @@ Public Class Main
End Try End Try
End Sub 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 Function ConvertCC(ByVal CC As String) As String
Try Try
If CC = "deDE" Then If CC = "deDE" Then
@ -2344,6 +2394,8 @@ Public Class Main
startinfo.RedirectStandardError = True startinfo.RedirectStandardError = True
startinfo.RedirectStandardOutput = True startinfo.RedirectStandardOutput = True
startinfo.CreateNoWindow = True startinfo.CreateNoWindow = True
startinfo.StandardOutputEncoding = Encoding.UTF8
startinfo.StandardErrorEncoding = Encoding.UTF8
AddHandler proc.ErrorDataReceived, AddressOf FFMPEGResoBack AddHandler proc.ErrorDataReceived, AddressOf FFMPEGResoBack
AddHandler proc.OutputDataReceived, AddressOf FFMPEGResoBack AddHandler proc.OutputDataReceived, AddressOf FFMPEGResoBack
proc.StartInfo = startinfo proc.StartInfo = startinfo
@ -3631,6 +3683,44 @@ Public Class Main
'CefSharp_Browser.WebBrowser1.LoadUrl(requesturl) '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() LoadedUrls.Clear()
Me.Text = "Crunchyroll Downloader" Me.Text = "Crunchyroll Downloader"
Exit Sub Exit Sub

View File

@ -32,6 +32,6 @@ Imports System.Runtime.InteropServices
' übernehmen, indem Sie "*" eingeben: ' übernehmen, indem Sie "*" eingeben:
' <Assembly: AssemblyVersion("1.0.*")> ' <Assembly: AssemblyVersion("1.0.*")>
<Assembly: AssemblyVersion("3.9.5")> <Assembly: AssemblyVersion("3.9.7")>
<Assembly: AssemblyFileVersion("3.9.5")> <Assembly: AssemblyFileVersion("3.9.7")>
<Assembly: NeutralResourcesLanguage("en")> <Assembly: NeutralResourcesLanguage("en")>

View File

@ -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) Dim Button As ToolStripMenuItem = CType(sender, ToolStripMenuItem)
If Button.Text = "-c copy" Then If Button.Text = "-c copy" Then
FFMPEG_CommandP1.Text = "-c copy" FFMPEG_CommandP1.Text = "-c copy"
@ -1327,6 +1327,7 @@ Public Class Einstellungen
#End Region #End Region