From c956218d4df5bc947a714713c54e51f0ec2d52f6 Mon Sep 17 00:00:00 2001 From: hama3254 <52826614+hama3254@users.noreply.github.com> Date: Tue, 7 Feb 2023 14:31:23 +0100 Subject: [PATCH] added fallback added fallback CR Seasons minor improvments --- .vs/Crunchyroll Downloader/v17/.suo | Bin 186880 -> 184832 bytes Crunchyroll Downloader/Anime_Add.vb | 3 - Crunchyroll Downloader/Browser.Designer.vb | 2 +- Crunchyroll Downloader/Browser.vb | 93 +++---- Crunchyroll Downloader/Main.vb | 228 ++++++++++-------- .../My Project/AssemblyInfo.vb | 4 +- Crunchyroll Downloader/einstellungen.vb | 9 +- 7 files changed, 165 insertions(+), 174 deletions(-) diff --git a/.vs/Crunchyroll Downloader/v17/.suo b/.vs/Crunchyroll Downloader/v17/.suo index dd56eb35a29be5857d411e2fe415926385f95160..be9d376905b520c70696d6cbc246195a36a87cc0 100644 GIT binary patch delta 7979 zcmeI14P2B}zQ>>cVR#e7;Y9>P90>*4VH!q4Ma72~4PQ`1*KLhd5Kt76a4=Dk5lu_Y zWX|TXaup{-x5dpEa(dew)4JB(ZH+Crs5LF`TDP)v^jmxrIUtYIw#m;{Od%^P z3sT=pA96nReOiVamTi0qTS7Jb9IN%-fQ(jN?X|QvgcPND43fAaz_+mJxxA5A5M7j)irxqgQD2#^m3gJ94Dqyb-$1j@kz5C{5zP(`U#`XQnNCZK`I zq;UhnbKo|R4tj#|AQH&?vV-tRN5_*9YQQM46l8;F5CZxFSw0?NHz4bM>zeFx(5Rj~OjYVZ0@CZQ`@(4ky z=Vn5X%DPqvKFGU~5THE8BLvxw>t;fTMd2F>L8?_YEQR3lRCmOGq!5Bo^;SX{f-=_$ zq0dc)z}x*#sw#ud!7wl!i~zFh9@5?EOoXG|@p%aEa>uzYAWAb039bgjQzb7A7#X<$ z$uck>lmlt20^xo9bhlpJ??-Ggs0K@r6KX#c;K!^%$No3;#SdNWxUBJJZ`p6fULC)a z?7EO+WYwOfp7wLvIO0*UasIR#E?*18;bj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JYEDy-Bn;TV28W2)d52`EiJf%9W?eTgS)K1xa(oAD>( K-O-w6V*FoH0&^|^ diff --git a/Crunchyroll Downloader/Anime_Add.vb b/Crunchyroll Downloader/Anime_Add.vb index c384245..07855b5 100644 --- a/Crunchyroll Downloader/Anime_Add.vb +++ b/Crunchyroll Downloader/Anime_Add.vb @@ -46,9 +46,6 @@ Public Class Anime_Add Btn_Close.Image = Main.CloseImg Btn_min.Image = Main.MinImg - - - Try Me.Icon = My.Resources.icon Catch ex As Exception diff --git a/Crunchyroll Downloader/Browser.Designer.vb b/Crunchyroll Downloader/Browser.Designer.vb index e854fcf..6a4cf84 100644 --- a/Crunchyroll Downloader/Browser.Designer.vb +++ b/Crunchyroll Downloader/Browser.Designer.vb @@ -78,7 +78,7 @@ Partial Class Browser ' 'Timer1 ' - Me.Timer1.Interval = 1000 + Me.Timer1.Interval = 60000 ' 'Timer2 ' diff --git a/Crunchyroll Downloader/Browser.vb b/Crunchyroll Downloader/Browser.vb index 57951f9..612a3f8 100644 --- a/Crunchyroll Downloader/Browser.vb +++ b/Crunchyroll Downloader/Browser.vb @@ -10,6 +10,7 @@ Imports System.Text Imports System.Security.Policy Imports Microsoft.Web.WebView2.Core Imports MetroFramework.Drawing +Imports Newtonsoft.Json.Linq Public Class Browser @@ -98,7 +99,7 @@ Public Class Browser If Main.UserBowser = False Then Me.Location = New Point(-10000, 10000) - + Timer1.Enabled = True End If WebView2.Source = New Uri(Main.Startseite) End Sub @@ -154,8 +155,26 @@ Public Class Browser + If CBool(InStr(e.Request.Uri, "crunchyroll.com/")) And CBool(InStr(e.Request.Uri, "v1/token")) And Main.CR_v1Token = "Get" Then + Debug.WriteLine("Crunchyroll-v1_token: " + 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 - If CBool(InStr(e.Request.Uri, "crunchyroll.com/")) And CBool(InStr(e.Request.Uri, "streams?")) Then + + Dim Loc_CR_Cookies = " -H " + Chr(34) + Main.CR_Cookies + Chr(34) + + Dim Token() As String = ContentString.Split(New String() {Chr(34) + "access_token" + Chr(34) + ":" + Chr(34)}, System.StringSplitOptions.RemoveEmptyEntries) + Dim Token2() As String = Token(1).Split(New String() {Chr(34) + "," + Chr(34)}, System.StringSplitOptions.RemoveEmptyEntries) + + Dim Auth As String = "Bearer " + Token2(0) + Dim Auth2 As String = " -H " + Chr(34) + "Authorization: " + Auth + Chr(34) + Main.ProcessLoading(Main.LoadingUrl, Auth2, Loc_CR_Cookies) + Main.CR_v1Token = "" + Exit Sub + + ElseIf CBool(InStr(e.Request.Uri, "crunchyroll.com/")) And CBool(InStr(e.Request.Uri, "streams?")) Then Debug.WriteLine("Crunchyroll-Single: " + e.Request.Uri) Dim Content As Stream = Await e.Response.GetContentAsync Dim ContentString As String = Nothing @@ -176,51 +195,15 @@ Public Class Browser ContentString = reader.ReadToEnd Main.CR_ObjectsJson = New UrlJson(e.Request.Uri, ContentString) - 'If CBool(InStr(WebView2.CoreWebView2.Source, "/objects/")) Then - ' ' MsgBox("True2") - ' Debug.WriteLine("Main.JSON: " + ContentString) - ' Dim StreamsUrlBuilder() As String = ContentString.Split(New String() {"videos/"}, System.StringSplitOptions.RemoveEmptyEntries) - ' Dim StreamsUrlBuilder2() As String = StreamsUrlBuilder(1).Split(New String() {"/streams"}, System.StringSplitOptions.RemoveEmptyEntries) - ' ' MsgBox("True3") - - ' Dim StreamsUrlBuilder3() As String = e.Request.Uri.Split(New String() {"objects/"}, System.StringSplitOptions.RemoveEmptyEntries) - ' Dim StreamsUrlBuilder4() As String = StreamsUrlBuilder3(1).Split(New String() {"?"}, System.StringSplitOptions.RemoveEmptyEntries) - - ' Dim StreamsUrl As String = StreamsUrlBuilder3(0) + "videos/" + StreamsUrlBuilder2(0) + "/streams?" + StreamsUrlBuilder4(1) - ' MsgBox(StreamsUrl) - ' WebView2.Source = New Uri(StreamsUrl) - - - 'End If Exit Sub - 'ElseIf CBool(InStr(e.Request.Uri, "crunchyroll.com/")) And CBool(InStr(e.Request.Uri, "seasons?series_id=")) And CBool(InStr(Main.LoadingUrl, "/series/")) Then - ' Debug.WriteLine("Crunchyroll-Season: " + e.Request.Uri) - ' Main.LoadedUrls.Add(e.Request) - ' Main.LoadedUrls.Add(e.Request) - ' Dim Content As Stream = Await e.Response.GetContentAsync - ' Dim ContentString As String = Nothing - ' 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(Main.WebbrowserURL, e.Request.Uri, "", ContentString) - ' End If - ' Exit Sub + ElseIf CBool(InStr(e.Request.Uri, "crunchyroll.com/")) And CBool(InStr(e.Request.Uri, "seasons?preferred_audio_language=")) And CBool(InStr(Main.LoadingUrl, "/series/")) Then + Debug.WriteLine("Crunchyroll-Season: " + e.Request.Uri) + Main.LoadedUrls.Add(e.Request) - - '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 + Exit Sub End If ElseIf CBool(InStr(Main.LoadingUrl, "funimation.com")) Then If CBool(InStr(e.Request.Uri, "?deviceType=web")) Then @@ -318,7 +301,7 @@ Public Class Browser Main.LoadedUrls.Add(e.Request) 'Main.CR_ObjectsJson = New UrlJson(e.Request.Uri, e.Request.Content.ToString) Exit Sub - ElseIf CBool(InStr(e.Request.Uri, "crunchyroll.com/")) And CBool(InStr(e.Request.Uri, "seasons?series_id=")) Then + ElseIf CBool(InStr(e.Request.Uri, "crunchyroll.com/")) And CBool(InStr(e.Request.Uri, "seasons?preferred_audio_language=")) Then Debug.WriteLine("Crunchyroll-Season: " + e.Request.Uri) Main.LoadedUrls.Add(e.Request) 'Main.CR_SeasonJson = New UrlJson(e.Request.Uri, e.Request.Content.ToString) @@ -368,29 +351,19 @@ Public Class Browser End Sub + Private Sub Timer1_Tick(sender As Object, e As EventArgs) Handles Timer1.Tick + 'If Main.UserBowser = False Then + ' WebView2.Reload() + 'Else + ' Timer1.Enabled = False + 'End If + End Sub Private Sub Timer2_Tick(sender As Object, e As EventArgs) Handles Timer2.Tick Me.Close() End Sub - - - - - - - - - - - - - - 'Private Sub WebBrowser1_ConsoleMessage(sender As Object, e As ConsoleMessageEventArgs) Handles WebBrowser1.ConsoleMessage - ' Debug.WriteLine(e.Message) - 'End Sub - End Class diff --git a/Crunchyroll Downloader/Main.vb b/Crunchyroll Downloader/Main.vb index a13a146..574ae90 100644 --- a/Crunchyroll Downloader/Main.vb +++ b/Crunchyroll Downloader/Main.vb @@ -32,6 +32,8 @@ Public Class Main Public CR_ObjectsJson As UrlJson = New UrlJson("", "") Public CR_VideoJson As UrlJson = New UrlJson("", "") Public CR_AuthToken As String = "" + Public CR_v1Token As String = "" + 'Public GetBetaSeasonsRetry As Boolean = False 'Public GetBetaSeasonSingle As Boolean = False @@ -1421,7 +1423,7 @@ Public Class Main VideoJson = CR_VideoJson.Content CR_VideoJson = New UrlJson("", "") ElseIf CBool(InStr(VideoJson, "curl:")) = True Then - VideoJson = Nothing + 'VideoJson = Nothing MsgBox("Error - Getting VideoJson data" + vbNewLine + VideoJson) Exit Sub End If @@ -3505,20 +3507,14 @@ Public Class Main End If Me.Text = "Status: Crunchyroll episode found." Debug.WriteLine("Crunchyroll episode found") - - GetBetaVideoProxy(Request.Uri, CR_AuthToken, WebbrowserURL) b = True - - 'Browser.WebBrowser1.LoadUrl(requesturl) - - LoadedUrls.Clear() Me.Text = "Crunchyroll Downloader" Exit Sub End If - ElseIf CBool(InStr(Request.Uri, "crunchyroll.com/")) And CBool(InStr(Request.Uri, "seasons?series_id=")) And CBool(InStr(WebbrowserURL, "series")) Then + ElseIf CBool(InStr(Request.Uri, "crunchyroll.com/")) And CBool(InStr(Request.Uri, "seasons?preferred_audio_language=")) And CBool(InStr(WebbrowserURL, "series")) Then If b = False Then @@ -3528,7 +3524,13 @@ Public Class Main Me.Text = "Status: Crunchyroll season found." Debug.WriteLine("Crunchyroll season found") - GetBetaSeasons(WebbrowserURL, Request.Uri, "") + Dim Auth As String = " -H " + Chr(34) + "Authorization: " + Request.Headers.GetHeader("Authorization") + Chr(34) + Debug.WriteLine(Auth) + + CR_Cookies = "Cookie: " + Request.Headers.GetHeader("Cookie") + + GetBetaSeasons(WebbrowserURL, Request.Uri, Auth) + 'Browser.WebBrowser1.LoadUrl(Request.Uri) b = True LoadedUrls.Clear() @@ -3959,6 +3961,12 @@ Public Class Main End If ElseIf strArray(0).Trim().ToUpper.Equals("GET") Then strRequest = strArray(1).Trim + + If CBool(InStr(strRequest, "403")) Then + strRequest = strRequest & defaultPage '"HTMLString" 'strRequest & defaultPage + SendHTMLResponse(stream, "index.html", Nothing, "HTTP/1.0 403 Forbidden") + End If + If strRequest.StartsWith("/") Then strRequest = strRequest.Substring(1) End If @@ -3984,7 +3992,7 @@ Public Class Main End Sub ' Send HTTP Response - Private Sub SendHTMLResponse(ByVal stream As NetworkStream, Optional ByVal httpRequest As String = Nothing, Optional ByVal Response As ServerResponse = Nothing) + Private Sub SendHTMLResponse(ByVal stream As NetworkStream, Optional ByVal httpRequest As String = Nothing, Optional ByVal Response As ServerResponse = Nothing, Optional ByVal httpCode As String = "HTTP/1.0 200 OK") Try Dim respByte() As Byte If httpRequest = Nothing Then @@ -3992,7 +4000,7 @@ Public Class Main respByte = System.Text.Encoding.UTF8.GetBytes(Response.Content) 'File.ReadAllBytes("") ' ' Set HTML Header Dim htmlHeader As String = - "HTTP/1.0 200 OK" & ControlChars.CrLf & + httpCode & ControlChars.CrLf & "Server: CRD 1.0" & ControlChars.CrLf & "Content-Length: " & respByte.Length & ControlChars.CrLf & "Content-Type: " & GetContentType(Response.Type) & @@ -4007,7 +4015,7 @@ Public Class Main respByte = System.Text.Encoding.UTF8.GetBytes(HTML) 'File.ReadAllBytes("") ' ' Set HTML Header Dim htmlHeader As String = - "HTTP/1.0 200 OK" & ControlChars.CrLf & + httpCode & ControlChars.CrLf & "Server: CRD 1.0" & ControlChars.CrLf & "Content-Length: " & respByte.Length & ControlChars.CrLf & "Content-Type: " & GetContentType(httpRequest) & @@ -4032,7 +4040,7 @@ Public Class Main respByte = File.ReadAllBytes(httpRequest) ' Set HTML Header Dim htmlHeader As String = - "HTTP/1.0 200 OK" & ControlChars.CrLf & + httpCode & ControlChars.CrLf & "Server: CRD 1.0" & ControlChars.CrLf & "Content-Length: " & respByte.Length & ControlChars.CrLf & "Content-Type: " & GetContentType(httpRequest) & ControlChars.CrLf & @@ -4359,6 +4367,7 @@ Public Class Main LoadingUrl = Url LoadedUrls.Clear() Dim NoBrowser As Boolean = False + 'CR_v1Token = "Get" 'Browser.WebView2.Source = New Uri(Url) 'Exit Sub 'MsgBox(Url) @@ -4426,9 +4435,14 @@ Public Class Main End If End If + Debug.WriteLine("###" + CR_Cookies + "###") + Dim Loc_CR_Cookies = " -H " + Chr(34) + CR_Cookies + Chr(34) + 'CR_v1Token = "Get" + 'Browser.WebView2.Source = New Uri(Url) + 'Exit Sub #End Region Dim Auth As String = " -H " + Chr(34) + "Authorization: " + CrBetaBasic + Chr(34) @@ -4460,114 +4474,115 @@ Public Class Main End If 'MsgBox(v1Token) - - If CBool(InStr(v1Token, "curl:")) = True Then - 'Browser.WebView2.CoreWebView2.Navigate(Url) - SetStatusLabel("Status: Critical error. #4425") + If CBool(InStr(v1Token, "curl: (60)")) = True Then + SetStatusLabel("Status: Critical error. #4478") + MsgBox("Please try the '--insecure' option found on the 'Main' page of the settings.") Exit Sub - End If + 'ElseIf CBool(InStr(v1Token, "curl:")) Then - ' + ElseIf CBool(InStr(v1Token, "curl:")) = True Then + Browser.WebView2.CoreWebView2.Navigate(Url) + Exit Sub + + End If Dim Token() As String = v1Token.Split(New String() {Chr(34) + "access_token" + Chr(34) + ":" + Chr(34)}, System.StringSplitOptions.RemoveEmptyEntries) Dim Token2() As String = Token(1).Split(New String() {Chr(34) + "," + Chr(34)}, System.StringSplitOptions.RemoveEmptyEntries) CRBetaBearer = CRBetaBearer + Token2(0) - Dim ObjectsUrl As String = Nothing - - Dim Auth2 As String = " -H " + Chr(34) + "Authorization: " + CRBetaBearer + Chr(34) + ProcessLoading(Url, Auth2, Loc_CR_Cookies) - If CBool(InStr(Url, "crunchyroll.com")) = True And CBool(InStr(Url, "series/")) = True Then - - Dim SeriesUrlBuilder() As String = Url.Split(New String() {"series/"}, System.StringSplitOptions.RemoveEmptyEntries) - Dim SeriesUrlBuilder2() As String = SeriesUrlBuilder(1).Split(New String() {"/"}, System.StringSplitOptions.RemoveEmptyEntries) - - - Dim SeriesUrl As String = "https://www.crunchyroll.com/content/v2/cms/series/" + SeriesUrlBuilder2(0) + "/seasons?preferred_audio_language=" + DubSprache.CR_Value + "&locale=" + locale '+ "&Signature=" + signature2(0) + "&Policy=" + policy2(0) + "&Key-Pair-Id=" + key_pair_id2(0) - Debug.WriteLine(SeriesUrl) - 'MsgBox(SeriesUrl) - GetBetaSeasons(Url, SeriesUrl, Auth2) - - - ElseIf CBool(InStr(Url, "crunchyroll.com")) = True And CBool(InStr(Url, "watch/")) = True And CBool(CrBetaBasic = Nothing) = False Then - - - - '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/content/v2/cms/objects/" + ObjectsURLBuilder4(0) + "?preferred_audio_language=" + DubSprache.CR_Value + "&locale=" + locale - 'End Using - 'MsgBox(ObjectsUrl) - - Debug.WriteLine("ObjectsUrl: " + ObjectsUrl) - - - Dim StreamsUrl As String = Nothing - Dim ObjectJson As String - Try - ObjectJson = CurlAuth(ObjectsUrl, Loc_CR_Cookies, Auth2) - - - '"curl:" 'Main.Curl(ObjectsUrl) - 'MsgBox(ObjectJson) - - 'If CBool(InStr(ObjectJson, "curl:")) = True Then - ' ObjectJson = Main.Curl(ObjectsUrl) - 'End If - - If CBool(InStr(ObjectJson, "curl:")) = True Then - Browser.WebView2.CoreWebView2.Navigate(ObjectsUrl) - LoadingUrl = ObjectsUrl - - Exit Sub - ElseIf CBool(InStr(ObjectJson, "videos/")) = False Then - - SetStatusLabel("Status: Failed - no video, check CR login") - Me.Text = "Status: Failed - no video, check CR login" - Debug.WriteLine("Status: Failed - no video, check CR login") - - Exit Sub - End If - - Catch ex As Exception - Browser.WebView2.CoreWebView2.Navigate(Url) - Exit Sub - End Try - - Try - 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) - - 'MsgBox(StreamsUrl) - - ' Debug.WriteLine(StreamsUrl) - Catch ex As Exception - Browser.WebView2.CoreWebView2.Navigate(Url) - Exit Sub - End Try - - GetBetaVideoProxy(StreamsUrl, Auth2, Url) - - - Else - Browser.WebView2.CoreWebView2.Navigate(Url) - End If Else 'to do End If End Sub + Public Sub ProcessLoading(ByVal url As String, Auth2 As String, ByVal Loc_CR_Cookies As String) + + If CBool(InStr(url, "crunchyroll.com")) = True And CBool(InStr(url, "series/")) = True Then + + Dim SeriesUrlBuilder() As String = url.Split(New String() {"series/"}, System.StringSplitOptions.RemoveEmptyEntries) + Dim SeriesUrlBuilder2() As String = SeriesUrlBuilder(1).Split(New String() {"/"}, System.StringSplitOptions.RemoveEmptyEntries) + + + Dim SeriesUrl As String = "https://www.crunchyroll.com/content/v2/cms/series/" + SeriesUrlBuilder2(0) + "/seasons?preferred_audio_language=" + DubSprache.CR_Value + "&locale=" + locale '+ "&Signature=" + signature2(0) + "&Policy=" + policy2(0) + "&Key-Pair-Id=" + key_pair_id2(0) + Debug.WriteLine(SeriesUrl) + 'MsgBox(SeriesUrl) + GetBetaSeasons(url, SeriesUrl, Auth2) + + + ElseIf CBool(InStr(url, "crunchyroll.com")) = True And CBool(InStr(url, "watch/")) = True And CBool(CrBetaBasic = Nothing) = False Then + + Dim ObjectsUrl As String = Nothing + + + '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/content/v2/cms/objects/" + ObjectsURLBuilder4(0) + "?preferred_audio_language=" + DubSprache.CR_Value + "&locale=" + locale + 'End Using + 'MsgBox(ObjectsUrl) + + Debug.WriteLine("ObjectsUrl: " + ObjectsUrl) + + + Dim StreamsUrl As String = Nothing + Dim ObjectJson As String + Try + ObjectJson = CurlAuth(ObjectsUrl, Loc_CR_Cookies, Auth2) + + If CBool(InStr(ObjectJson, "curl:")) = True Then + Browser.WebView2.CoreWebView2.Navigate(ObjectsUrl) + LoadingUrl = ObjectsUrl + + Exit Sub + ElseIf CBool(InStr(ObjectJson, "videos/")) = False Then + + SetStatusLabel("Status: Failed - no video, check CR login") + Me.Text = "Status: Failed - no video, check CR login" + Debug.WriteLine("Status: Failed - no video, check CR login") + + Exit Sub + End If + + Catch ex As Exception + Browser.WebView2.CoreWebView2.Navigate(url) + Exit Sub + End Try + + Try + 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) + + 'MsgBox(StreamsUrl) + + ' Debug.WriteLine(StreamsUrl) + Catch ex As Exception + Browser.WebView2.CoreWebView2.Navigate(url) + Exit Sub + End Try + + GetBetaVideoProxy(StreamsUrl, Auth2, url) + + + Else + Browser.WebView2.CoreWebView2.Navigate(url) + End If + + + End Sub + + Public Function GetCookiesFromFile(ByVal Host As String) As String Dim Cookies As String = "Cookie: " @@ -4614,6 +4629,7 @@ Public Class Main Sub SetStatusLabel(ByVal txt As String) If Application.OpenForms().OfType(Of Anime_Add).Any = True Then Anime_Add.StatusLabel.Text = txt + End If End Sub diff --git a/Crunchyroll Downloader/My Project/AssemblyInfo.vb b/Crunchyroll Downloader/My Project/AssemblyInfo.vb index 38ffdd0..978e06e 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 7ea93c6..a2c4f50 100644 --- a/Crunchyroll Downloader/einstellungen.vb +++ b/Crunchyroll Downloader/einstellungen.vb @@ -677,9 +677,14 @@ Public Class Einstellungen ffpmeg_cmd = " " + FFMPEG_CommandP1.Text + " " + FFMPEG_CommandP2.Text + " " + FFMPEG_CommandP3.Text + " " + FFMPEG_CommandP4.Text End If + If Main.ffmpeg_command = My.Settings.ffmpeg_command_override Then + 'override should not get overwritten + + Else + Main.ffmpeg_command = ffpmeg_cmd + My.Settings.ffmpeg_command = Main.ffmpeg_command + End If - Main.ffmpeg_command = ffpmeg_cmd - My.Settings.ffmpeg_command = Main.ffmpeg_command If CBool(InStr(FFMPEG_CommandP1.Text, "nvenc")) = True And CBool(Main.VideoFormat = ".aac") = False Then