mirror of
https://github.com/hama3254/Crunchyroll-Downloader-v3.0.git
synced 2024-11-14 20:25:06 +01:00
Curl timeout; bugfixes
added timeout for curl requests fix locale value for api requests added locale value for mutli download added an extra check for series false postives
This commit is contained in:
parent
c1494366f2
commit
3014a1d628
Binary file not shown.
@ -27,11 +27,23 @@ Public Class Anime_Add
|
||||
|
||||
'Main.LoadedUrl = Url
|
||||
|
||||
If CBool(InStr(Url, "crunchyroll.com")) = True And CBool(InStr(Url, "series")) = True Then
|
||||
|
||||
If CBool(InStr(Url, "crunchyroll.com")) = True And CBool(InStr(Url, "watch")) = True And CBool(Main.CrBetaBasic = Nothing) = False Then
|
||||
Dim locale1() As String = Url.Split(New String() {"crunchyroll.com/"}, System.StringSplitOptions.RemoveEmptyEntries)
|
||||
Dim locale2() As String = locale1(1).Split(New String() {"/series"}, System.StringSplitOptions.RemoveEmptyEntries)
|
||||
Main.locale = Main.Convert_locale(locale2(0))
|
||||
If Main.locale = "en-US" Then
|
||||
Main.Url_locale = ""
|
||||
Else
|
||||
Main.Url_locale = locale2(0)
|
||||
End If
|
||||
CefSharp_Browser.WebBrowser1.Load(Url)
|
||||
|
||||
ElseIf 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: "
|
||||
Try
|
||||
|
||||
Dim rk As RegistryKey = Registry.CurrentUser.CreateSubKey("Software\CRDownloader")
|
||||
Dim etp_rt As Boolean = False
|
||||
Dim ajs_user_id As Boolean = False
|
||||
@ -46,10 +58,10 @@ Public Class Anime_Add
|
||||
If CBool(InStr(list.Item(i).Domain, ".crunchyroll.com")) And CBool(InStr(list.Item(i).Name, "_evidon_suppress")) = False Then
|
||||
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
|
||||
Main.locale = list.Item(i).Value
|
||||
'If CBool(InStr(list.Item(i).Domain, ".crunchyroll.com")) And CBool(InStr(list.Item(i).Name, "c_locale")) Then
|
||||
' 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
|
||||
' Debug.WriteLine("etp_rt = True")
|
||||
' etp_rt = True
|
||||
@ -70,6 +82,11 @@ Public Class Anime_Add
|
||||
'MsgBox(locale2(0))
|
||||
Main.locale = Main.Convert_locale(locale2(0))
|
||||
'End If
|
||||
If Main.locale = "en-US" Then
|
||||
Main.Url_locale = ""
|
||||
Else
|
||||
Main.Url_locale = locale2(0)
|
||||
End If
|
||||
|
||||
'MsgBox(Main.locale)
|
||||
|
||||
@ -149,37 +166,39 @@ Public Class Anime_Add
|
||||
' 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)
|
||||
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)
|
||||
|
||||
If CBool(InStr(v2Content, "curl:")) = True Then
|
||||
v2Content = Main.CurlAuth("https://www.crunchyroll.com/index/v2", Main.CR_Cookies, Auth2)
|
||||
End If
|
||||
If CBool(InStr(v2Content, "curl:")) = True Then
|
||||
v2Content = Main.CurlAuth("https://www.crunchyroll.com/index/v2", Main.CR_Cookies, Auth2)
|
||||
End If
|
||||
|
||||
If CBool(InStr(v2Content, "curl:")) = True Then
|
||||
CefSharp_Browser.WebBrowser1.Load(Url)
|
||||
Exit Sub
|
||||
End If
|
||||
If CBool(InStr(v2Content, "curl:")) = True Then
|
||||
CefSharp_Browser.WebBrowser1.Load(Url)
|
||||
Exit Sub
|
||||
End If
|
||||
|
||||
|
||||
Dim v2ContentBeta() As String = v2Content.Split(New String() {Chr(34) + "cms_web" + Chr(34) + ":"}, System.StringSplitOptions.RemoveEmptyEntries)
|
||||
Dim v2ContentBeta() As String = v2Content.Split(New String() {Chr(34) + "cms_web" + Chr(34) + ":"}, System.StringSplitOptions.RemoveEmptyEntries)
|
||||
|
||||
|
||||
Dim bucket() As String = v2ContentBeta(1).Split(New String() {Chr(34) + "bucket" + Chr(34) + ":" + Chr(34)}, System.StringSplitOptions.RemoveEmptyEntries)
|
||||
Dim bucket2() As String = bucket(1).Split(New String() {Chr(34) + "," + Chr(34)}, System.StringSplitOptions.RemoveEmptyEntries)
|
||||
Dim bucket() As String = v2ContentBeta(1).Split(New String() {Chr(34) + "bucket" + Chr(34) + ":" + Chr(34)}, System.StringSplitOptions.RemoveEmptyEntries)
|
||||
Dim bucket2() As String = bucket(1).Split(New String() {Chr(34) + "," + Chr(34)}, System.StringSplitOptions.RemoveEmptyEntries)
|
||||
|
||||
Dim policy() As String = v2ContentBeta(1).Split(New String() {Chr(34) + "policy" + Chr(34) + ":" + Chr(34)}, System.StringSplitOptions.RemoveEmptyEntries)
|
||||
Dim policy2() As String = policy(1).Split(New String() {Chr(34) + "," + Chr(34)}, System.StringSplitOptions.RemoveEmptyEntries)
|
||||
Dim policy() As String = v2ContentBeta(1).Split(New String() {Chr(34) + "policy" + Chr(34) + ":" + Chr(34)}, System.StringSplitOptions.RemoveEmptyEntries)
|
||||
Dim policy2() As String = policy(1).Split(New String() {Chr(34) + "," + Chr(34)}, System.StringSplitOptions.RemoveEmptyEntries)
|
||||
|
||||
Dim signature() As String = v2ContentBeta(1).Split(New String() {Chr(34) + "signature" + Chr(34) + ":" + Chr(34)}, System.StringSplitOptions.RemoveEmptyEntries)
|
||||
Dim signature2() As String = signature(1).Split(New String() {Chr(34) + "," + Chr(34)}, System.StringSplitOptions.RemoveEmptyEntries)
|
||||
Dim signature() As String = v2ContentBeta(1).Split(New String() {Chr(34) + "signature" + Chr(34) + ":" + Chr(34)}, System.StringSplitOptions.RemoveEmptyEntries)
|
||||
Dim signature2() As String = signature(1).Split(New String() {Chr(34) + "," + Chr(34)}, System.StringSplitOptions.RemoveEmptyEntries)
|
||||
|
||||
Dim key_pair_id() As String = v2ContentBeta(1).Split(New String() {Chr(34) + "key_pair_id" + Chr(34) + ":" + Chr(34)}, System.StringSplitOptions.RemoveEmptyEntries)
|
||||
Dim key_pair_id2() As String = key_pair_id(1).Split(New String() {Chr(34) + "," + Chr(34)}, System.StringSplitOptions.RemoveEmptyEntries)
|
||||
Dim key_pair_id() As String = v2ContentBeta(1).Split(New String() {Chr(34) + "key_pair_id" + Chr(34) + ":" + Chr(34)}, System.StringSplitOptions.RemoveEmptyEntries)
|
||||
Dim key_pair_id2() As String = key_pair_id(1).Split(New String() {Chr(34) + "," + Chr(34)}, System.StringSplitOptions.RemoveEmptyEntries)
|
||||
|
||||
Dim ObjectsURLBuilder3() As String = Url.Split(New String() {"watch/"}, System.StringSplitOptions.RemoveEmptyEntries)
|
||||
Dim ObjectsURLBuilder4() As String = ObjectsURLBuilder3(1).Split(New String() {"/"}, System.StringSplitOptions.RemoveEmptyEntries)
|
||||
|
||||
'MsgBox(Url)
|
||||
Dim ObjectsURLBuilder3() As String = Url.Split(New String() {"watch/"}, 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=" + Main.locale + "&Signature=" + signature2(0) + "&Policy=" + policy2(0) + "&Key-Pair-Id=" + key_pair_id2(0)
|
||||
@ -189,13 +208,13 @@ Public Class Anime_Add
|
||||
Debug.WriteLine("ObjectsUrl: " + ObjectsUrl)
|
||||
|
||||
|
||||
'Catch ex As Exception
|
||||
' MsgBox(ex.ToString)
|
||||
' CefSharp_Browser.WebBrowser1.Load(Url)
|
||||
' Exit Sub
|
||||
'End Try
|
||||
'Catch ex As Exception
|
||||
' MsgBox(ex.ToString)
|
||||
' 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)
|
||||
|
@ -34,6 +34,8 @@ Public Class Main
|
||||
Public CrBetaMassBaseURL As String = Nothing
|
||||
Public CrBetaBasic As String = Nothing
|
||||
Public locale As String = Nothing
|
||||
Public Url_locale As String = Nothing
|
||||
|
||||
'Public CrBetaObjects As String = Nothing
|
||||
'Public CrBetaStreams As String = Nothing
|
||||
'Public CrBetaStreamsUrl As String = Nothing
|
||||
@ -1052,22 +1054,35 @@ Public Class Main
|
||||
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
|
||||
Loop Until Proc.HasExited Or Microsoft.VisualBasic.DateAndTime.Timer < finish
|
||||
|
||||
If CurlOutput = Nothing Then
|
||||
|
||||
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
|
||||
|
||||
Else
|
||||
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
|
||||
|
||||
|
||||
@ -1108,6 +1123,10 @@ Public Class Main
|
||||
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
|
||||
@ -1115,19 +1134,26 @@ Public Class Main
|
||||
'ffmpegOutput2 = sr.ReadLine
|
||||
Debug.WriteLine(CurlOutput)
|
||||
|
||||
Loop Until Proc.HasExited
|
||||
Loop Until Proc.HasExited Or Microsoft.VisualBasic.DateAndTime.Timer < finish
|
||||
|
||||
If CurlOutput = Nothing Then
|
||||
|
||||
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
|
||||
|
||||
Else
|
||||
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
|
||||
|
||||
|
||||
@ -1168,20 +1194,34 @@ Public Class Main
|
||||
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
|
||||
Loop Until Proc.HasExited Or Microsoft.VisualBasic.DateAndTime.Timer < finish
|
||||
|
||||
If CurlOutput = Nothing Then
|
||||
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
|
||||
Else
|
||||
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
|
||||
|
||||
|
||||
@ -1207,7 +1247,12 @@ Public Class Main
|
||||
Dim EpisodeSplit4() As String = EpisodeSplit3(1).Split(New String() {Chr(34)}, System.StringSplitOptions.RemoveEmptyEntries)
|
||||
|
||||
'MsgBox("https://www.crunchyroll.com/watch/" + EpisodeSplit2(0) + "/" + EpisodeSplit4(0) + "/")
|
||||
ListOfEpisodes.Add("https://www.crunchyroll.com/watch/" + EpisodeSplit2(0) + "/" + EpisodeSplit4(0) + "/")
|
||||
If Url_locale = "" Then
|
||||
ListOfEpisodes.Add("https://www.crunchyroll.com/watch/" + EpisodeSplit2(0) + "/" + EpisodeSplit4(0) + "/")
|
||||
Else
|
||||
ListOfEpisodes.Add("https://www.crunchyroll.com/" + Url_locale + "/" + "watch/" + EpisodeSplit2(0) + "/" + EpisodeSplit4(0) + "/")
|
||||
End If
|
||||
|
||||
Next
|
||||
Dim First As Integer = 0
|
||||
Dim Last As Integer = 0
|
||||
@ -2120,7 +2165,7 @@ Public Class Main
|
||||
ElseIf locale = "pt-pt" Then
|
||||
Return "pt-PT"
|
||||
Else
|
||||
Return CB_SuB_Nothing
|
||||
Return "en-US"
|
||||
End If
|
||||
Catch ex As Exception
|
||||
Return Nothing
|
||||
@ -3725,7 +3770,7 @@ Public Class Main
|
||||
Me.Text = "Crunchyroll Downloader"
|
||||
Exit Sub
|
||||
End If
|
||||
ElseIf CBool(InStr(requesturl, "crunchyroll.com/")) And CBool(InStr(requesturl, "seasons?series_id=")) Then
|
||||
ElseIf CBool(InStr(requesturl, "crunchyroll.com/")) And CBool(InStr(requesturl, "seasons?series_id=")) And CBool(InStr(WebbrowserURL, "series")) Then
|
||||
|
||||
If b = False Then
|
||||
|
||||
|
@ -32,6 +32,6 @@ Imports System.Runtime.InteropServices
|
||||
' übernehmen, indem Sie "*" eingeben:
|
||||
' <Assembly: AssemblyVersion("1.0.*")>
|
||||
|
||||
<Assembly: AssemblyVersion("3.9.7")>
|
||||
<Assembly: AssemblyFileVersion("3.9.7")>
|
||||
<Assembly: AssemblyVersion("3.9.8")>
|
||||
<Assembly: AssemblyFileVersion("3.9.8")>
|
||||
<Assembly: NeutralResourcesLanguage("en")>
|
||||
|
Loading…
Reference in New Issue
Block a user