improved caching

improved caching
This commit is contained in:
hama3254 2022-12-27 17:04:25 +01:00
parent 8e7544b100
commit 190964aa81
7 changed files with 90 additions and 46 deletions

Binary file not shown.

View File

@ -393,9 +393,9 @@ Partial Class Anime_Add
Me.Controls.Add(Me.btn_dl)
Me.Controls.Add(Me.Btn_min)
Me.Controls.Add(Me.Btn_Close)
Me.Controls.Add(Me.GroupBox3)
Me.Controls.Add(Me.groupBox2)
Me.Controls.Add(Me.groupBox1)
Me.Controls.Add(Me.GroupBox3)
Me.Font = New System.Drawing.Font("Arial", 24.0!, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, CType(0, Byte))
Me.Name = "Anime_Add"
Me.Padding = New System.Windows.Forms.Padding(10, 60, 20, 20)

View File

@ -127,7 +127,7 @@
<data name="Btn_min.Image" type="System.Drawing.Bitmap, System.Drawing" mimetype="application/x-microsoft.net.object.bytearray.base64">
<value>
iVBORw0KGgoAAAANSUhEUgAAABoAAAAhCAYAAADH97ugAAAABGdBTUEAALGPC/xhBQAAAAlwSFlzAAAO
vQAADr0BR/uQrQAAAAd0SU1FB+QMDQ03N1b5UIAAAAApSURBVEhL7cyxCQAwDASx339pZ4EUcTC4keDa
vAAADrwBlbxySQAAAAd0SU1FB+QMDQ03N1b5UIAAAAApSURBVEhL7cyxCQAwDASx339pZ4EUcTC4keDa
CwDMqs/abpOXAGBZcgDKSBvlblfsRgAAAABJRU5ErkJggg==
</value>
</data>

View File

@ -54,7 +54,7 @@ Public Class Anime_Add
Next
Debug.WriteLine(Cookies)
'Debug.WriteLine(Cookies)
Return Cookies
End Function
@ -153,7 +153,7 @@ Public Class Anime_Add
End If
MsgBox(v1Token)
'MsgBox(v1Token)
If CBool(InStr(v1Token, "curl:")) = True And CBool(InStr(v1Token, "400")) = True Then
Me.StatusLabel.Text = "Status: Failed - bad request, check CR login"
@ -174,6 +174,7 @@ Public Class Anime_Add
End If
'MsgBox(v1Token)
If CBool(InStr(v1Token, "curl:")) = True Then
Browser.WebView2.CoreWebView2.Navigate(Url)
@ -263,9 +264,8 @@ Public Class Anime_Add
'End If
If CBool(InStr(ObjectJson, "curl:")) = True Then
MsgBox(ObjectJson)
'Browser.WebView2.CoreWebView2.Navigate(ObjectsUrl)
' Main.LoadingUrl = ObjectsUrl
Browser.WebView2.CoreWebView2.Navigate(ObjectsUrl)
Main.LoadingUrl = ObjectsUrl
Exit Sub
ElseIf CBool(InStr(ObjectJson, "videos/")) = False Then
@ -488,7 +488,7 @@ Public Class Anime_Add
Dim Episode0() As String = textBox1.Text.Split(New String() {"?"}, System.StringSplitOptions.RemoveEmptyEntries)
Dim Episode() As String = Episode0(0).Split(New String() {"/"}, System.StringSplitOptions.RemoveEmptyEntries)
Dim v1JsonUrl As String = "https://d33et77evd9bgg.cloudfront.net/data/v1/episodes/" + Episode(Episode.Length - 1) + ".json"
MsgBox(v1JsonUrl)
'MsgBox(v1JsonUrl)
Dim v1Json As String = Nothing
Try
Using client As New WebClient()
@ -696,39 +696,20 @@ Public Class Anime_Add
Dim EpisodeJsonURL As String = Main.CrBetaMassBaseURL + "episodes?season_id=" + SeasonSplit2(0) + "&locale=" + Main.CrBetaMassParameters
Debug.WriteLine(EpisodeJsonURL)
'Debug.WriteLine(EpisodeJsonURL)
Dim EpisodeJson As String = Main.Curl(EpisodeJsonURL) 'localHTML.Replace("<body>", "").Replace("</body>", "").Replace("<pre>", "").Replace("</pre>", "").Replace("</html>", "").Replace(My.Resources.htmlReplace, "")
If CBool(InStr(EpisodeJson, "curl:")) Then
Main.CrBetaMassEpisodes = EpisodeJson
Main.GetBetaSeasonSingle = True
Browser.WebView2.Source = New Uri(EpisodeJsonURL)
Exit Sub
Dim EpisodeNameSplit() As String = EpisodeJson.Split(New String() {Chr(34) + "title" + Chr(34) + ":" + Chr(34)}, System.StringSplitOptions.RemoveEmptyEntries)
Dim EpisodeSplit() As String = EpisodeJson.Split(New String() {Chr(34) + "episode" + Chr(34) + ":" + Chr(34)}, System.StringSplitOptions.RemoveEmptyEntries)
For i As Integer = 1 To EpisodeSplit.Count - 1
Dim EpisodeSplit2() As String = EpisodeSplit(i).Split(New String() {Chr(34)}, System.StringSplitOptions.RemoveEmptyEntries)
Dim EpisodeNameSplit2() As String = EpisodeNameSplit(i).Split(New String() {Chr(34)}, System.StringSplitOptions.RemoveEmptyEntries)
If EpisodeSplit(i).Substring(0, 1) = Chr(34) Then
comboBox3.Items.Add(EpisodeNameSplit2(0))
comboBox4.Items.Add(EpisodeNameSplit2(0))
Else
comboBox3.Items.Add("Episode " + EpisodeSplit2(0))
comboBox4.Items.Add("Episode " + EpisodeSplit2(0))
End If
Next
If comboBox3.Items.Count > 0 Then
comboBox3.SelectedIndex = 0
comboBox4.SelectedIndex = comboBox4.Items.Count - 1
End If
comboBox3.Enabled = True
comboBox4.Enabled = True
FillCREpisodes(EpisodeJson)
@ -785,7 +766,36 @@ Public Class Anime_Add
End If
End Sub
Public Sub FillCREpisodes(ByVal EpisodeJson As String)
'MsgBox(True.ToString)
Main.CrBetaMassEpisodes = EpisodeJson
Dim EpisodeNameSplit() As String = EpisodeJson.Split(New String() {Chr(34) + "title" + Chr(34) + ":" + Chr(34)}, System.StringSplitOptions.RemoveEmptyEntries)
Dim EpisodeSplit() As String = EpisodeJson.Split(New String() {Chr(34) + "episode" + Chr(34) + ":" + Chr(34)}, System.StringSplitOptions.RemoveEmptyEntries)
For i As Integer = 1 To EpisodeSplit.Count - 1
Dim EpisodeSplit2() As String = EpisodeSplit(i).Split(New String() {Chr(34)}, System.StringSplitOptions.RemoveEmptyEntries)
Dim EpisodeNameSplit2() As String = EpisodeNameSplit(i).Split(New String() {Chr(34)}, System.StringSplitOptions.RemoveEmptyEntries)
If EpisodeSplit(i).Substring(0, 1) = Chr(34) Then
comboBox3.Items.Add(EpisodeNameSplit2(0))
comboBox4.Items.Add(EpisodeNameSplit2(0))
Else
comboBox3.Items.Add("Episode " + EpisodeSplit2(0))
comboBox4.Items.Add("Episode " + EpisodeSplit2(0))
End If
Next
If comboBox3.Items.Count > 0 Then
comboBox3.SelectedIndex = 0
comboBox4.SelectedIndex = comboBox4.Items.Count - 1
End If
comboBox3.Enabled = True
comboBox4.Enabled = True
End Sub
Public Sub FillFunimationEpisodes(ByVal EpisodeJson As String)

View File

@ -202,9 +202,23 @@ Public Class Browser
Dim reader As New StreamReader(Content)
ContentString = reader.ReadToEnd
Main.CR_SeasonJson = New UrlJson(e.Request.Uri, ContentString)
If Main.GetBetaSeasonsRetry = True Then
Main.GetBetaSeasonsRetry = False
Main.GetBetaSeasons(e.Request.Uri, ContentString)
End If
Exit Sub
ElseIf CBool(InStr(e.Request.Uri, "crunchyroll.com/")) And CBool(InStr(e.Request.Uri, "episodes?season_id=")) And Main.GetBetaSeasonSingle = True Then
Debug.WriteLine("Crunchyroll-Single-Season: " + e.Request.Uri)
Dim Content As Stream = Await e.Response.GetContentAsync
Dim ContentString As String = Nothing
Dim reader As New StreamReader(Content)
ContentString = reader.ReadToEnd
Main.GetBetaSeasonSingle = False
Anime_Add.FillCREpisodes(ContentString)
Exit Sub
End If
ElseIf CBool(InStr(Main.LoadingUrl, "funimation.com")) Then
If CBool(InStr(e.Request.Uri, "?deviceType=web")) Then
'Debug.WriteLine(e.Request.Uri)

View File

@ -33,6 +33,8 @@ Public Class Main
Public CR_VideoJson As UrlJson = New UrlJson("", "")
Public CR_AuthToken As String = ""
Public GetBetaSeasonsRetry As Boolean = False
Public GetBetaSeasonSingle As Boolean = False
Public CrBetaMass As String = Nothing
Public CrBetaMassEpisodes As String = Nothing
Public CrBetaMassParameters As String = Nothing
@ -1127,7 +1129,7 @@ Public Class Main
Anime_Add.btn_dl.Text = "Download" 'Anime_Add.btn_dl.BackgroundImage = My.Resources.main_button_download_default
End Sub
Public Sub GetBetaSeasons(ByVal JsonUrl As String) ', ByVal SeasonJson As String)
Public Sub GetBetaSeasons(ByVal JsonUrl As String, Optional ByVal BrowserData As String = Nothing) ', ByVal SeasonJson As String)
Anime_Add.groupBox2.Visible = True
Anime_Add.bt_Cancel_mass.Enabled = True
Anime_Add.bt_Cancel_mass.Visible = True
@ -1151,16 +1153,34 @@ Public Class Main
'Catch ex As Exception
' Debug.WriteLine("error- getting SeasonJson data")
'End Try
If BrowserData = Nothing Then
SeasonJson = Curl(JsonUrl)
If CBool(InStr(SeasonJson, "curl:")) = True Then
SeasonJson = Curl(JsonUrl)
End If
If CBool(InStr(SeasonJson, "curl:")) = True Then
If CBool(InStr(SeasonJson, "curl:")) = True And (CR_SeasonJson.Url = JsonUrl) = False Then
GetBetaSeasonsRetry = True
Browser.WebView2.Source = New Uri(JsonUrl)
Exit Sub
End If
If CBool(InStr(SeasonJson, "curl:")) = True And CBool(InStr(CR_SeasonJson.Url, JsonUrl)) Then
Debug.WriteLine("curl error, using CR_SeasonJson ")
SeasonJson = CR_SeasonJson.Content
CR_ObjectsJson = New UrlJson("", "")
ElseIf CBool(InStr(SeasonJson, "curl:")) = True Then
MsgBox("Error - Getting SeasonJson data" + vbNewLine + SeasonJson + vbNewLine + vbNewLine + JsonUrl)
Exit Sub
End If
Else
SeasonJson = BrowserData
Debug.WriteLine("BrowserData: " + BrowserData)
End If
SeasonJson = CleanJSON(SeasonJson)
Dim ParameterSplit() As String = JsonUrl.Split(New String() {"&locale="}, System.StringSplitOptions.RemoveEmptyEntries)
CrBetaMassParameters = ParameterSplit(1)

View File

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