Skip to content
This repository has been archived by the owner on Jul 13, 2024. It is now read-only.

Commit

Permalink
fallback CR 403 added
Browse files Browse the repository at this point in the history
fallback CR 403 added
  • Loading branch information
hama3254 committed Dec 5, 2022
1 parent ce0d9f7 commit e76ad3b
Show file tree
Hide file tree
Showing 6 changed files with 267 additions and 223 deletions.
Binary file modified .vs/Crunchyroll Downloader/v17/.suo
Binary file not shown.
121 changes: 102 additions & 19 deletions Crunchyroll Downloader/Browser.vb
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,10 @@ Public Class Browser
Private Sub WebView2_CoreWebView2InitializationCompleted(sender As Object, e As CoreWebView2InitializationCompletedEventArgs) Handles WebView2.CoreWebView2InitializationCompleted
WebView2.CoreWebView2.AddWebResourceRequestedFilter("https://www.crunchyroll.com/*", CoreWebView2WebResourceContext.All)
WebView2.CoreWebView2.AddWebResourceRequestedFilter("https://www.funimation.com/*", CoreWebView2WebResourceContext.All)
WebView2.CoreWebView2.AddWebResourceRequestedFilter("https://www.crunchyroll.com/*", CoreWebView2WebResourceContext.All)

'WebView2.CoreWebView2.AddWebResourceRequestedFilter("*", CoreWebView2WebResourceContext.All)
AddHandler WebView2.CoreWebView2.WebResourceResponseReceived, AddressOf ObserveResponse

AddHandler WebView2.CoreWebView2.WebResourceRequested, AddressOf ObserveHttp
WebView2.CoreWebView2.Settings.UserAgent = My.Resources.ffmpeg_user_agend.Replace(Chr(34), "").Replace("User-Agent: ", "")
Expand Down Expand Up @@ -69,7 +72,7 @@ Public Class Browser
End Sub


Private Sub GeckoFX_Load(sender As Object, e As EventArgs) Handles Me.Load
Private Sub Browser_Load(sender As Object, e As EventArgs) Handles Me.Load
Main.waveOutSetVolume(0, 0)
If Me.Width > My.Computer.Screen.Bounds.Width Then
Me.Width = My.Computer.Screen.Bounds.Width
Expand Down Expand Up @@ -141,48 +144,75 @@ Public Class Browser
End Sub


Private Async Sub ObserveResponse(ByVal sender As Object, ByVal e As CoreWebView2WebResourceResponseReceivedEventArgs)




If CBool(InStr(Main.LoadingUrl, "crunchyroll.com")) Then


Private Sub ObserveHttp(ByVal sender As Object, ByVal e As CoreWebView2WebResourceRequestedEventArgs) 'Handles RequestResource.GetUrl

If CBool(InStr(e.Request.Uri, "crunchyroll.com")) = True And Main.CrBetaBasic = Nothing Then
Dim Headers As New List(Of KeyValuePair(Of String, String))
Headers.AddRange(e.Request.Headers.ToList)
For i As Integer = 0 To Headers.Count
If CBool(InStr(Headers.Item(i).Value, "Basic")) Then
Main.CrBetaBasic = Headers.Item(i).Value
Debug.WriteLine(Main.CrBetaBasic)
End If
Next
End If



If CBool(InStr(Main.LoadingUrl, "crunchyroll.com")) Then
If 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
Dim reader As New StreamReader(Content)
ContentString = reader.ReadToEnd

Main.LoadedUrls.Add(e.Request.Uri)
Main.CR_VideoJson = New UrlJson(e.Request.Uri, ContentString)

Exit Sub
ElseIf CBool(InStr(e.Request.Uri, "crunchyroll.com/")) And CBool(InStr(e.Request.Uri, "/objects/")) And CBool(InStr(Main.LoadingUrl, "/watch/")) Then
Debug.WriteLine(e.Request.Uri)
Main.LoadedUrls.Add(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.CR_ObjectsJson = New UrlJson(e.Request.Uri, ContentString)
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.Uri)
Main.LoadedUrls.Add(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.CR_SeasonJson = New UrlJson(e.Request.Uri, 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)
Dim parms As String() = e.Request.Uri.Split(New String() {"?deviceType="}, System.StringSplitOptions.RemoveEmptyEntries)
Main.FunimationDeviceRegion = "?deviceType=" + parms(1)

End If
If CBool(InStr(e.Request.Uri, "https://title-api.prd.funimationsvc.com")) Then
Debug.WriteLine("Funimtaion: " + e.Request.Uri)
If (Me.InvokeRequired) Then
Me.Invoke(Sub() Main.LoadedUrls.Add(e.Request.Uri))
Exit Sub
Else
Main.LoadedUrls.Add(e.Request.Uri)
Exit Sub
End If
ElseIf CBool(InStr(e.Request.Uri, "crunchyroll.com/")) And CBool(InStr(e.Request.Uri, "/objects/")) And CBool(InStr(e.Request.Uri, "/watch/")) Then
ElseIf CBool(InStr(e.Request.Uri, "/data/v2/shows/")) Then
Debug.WriteLine("Funimtaion: " + e.Request.Uri)
If (Me.InvokeRequired) Then
Me.Invoke(Sub() Main.LoadedUrls.Add(e.Request.Uri))
Exit Sub
Else
Main.LoadedUrls.Add(e.Request.Uri)
Exit Sub
End If
Debug.WriteLine(e.Request.Uri)
ElseIf CBool(InStr(e.Request.Uri, "crunchyroll.com/")) And CBool(InStr(e.Request.Uri, "seasons?series_id=")) Then
Debug.WriteLine("Crunchyroll-Season: " + e.Request.Uri)
ElseIf CBool(InStr(e.Request.Uri, "/data/v1/episodes/")) Then
Debug.WriteLine("Funimtaion: " + e.Request.Uri)
If (Me.InvokeRequired) Then
Me.Invoke(Sub() Main.LoadedUrls.Add(e.Request.Uri))
Exit Sub
Expand All @@ -194,6 +224,59 @@ Public Class Browser



End If

End Sub







Private Sub ObserveHttp(ByVal sender As Object, ByVal e As CoreWebView2WebResourceRequestedEventArgs) 'Handles RequestResource.GetUrl


If CBool(InStr(e.Request.Uri, "crunchyroll.com")) = True And Main.CrBetaBasic = Nothing Then
Dim Headers As New List(Of KeyValuePair(Of String, String))
Headers.AddRange(e.Request.Headers.ToList)
For i As Integer = 0 To Headers.Count
If CBool(InStr(Headers.Item(i).Value, "Basic")) Then
Main.CrBetaBasic = Headers.Item(i).Value
Debug.WriteLine(Main.CrBetaBasic)
End If
Next
End If

Exit Sub

If CBool(InStr(Main.LoadingUrl, "crunchyroll.com")) Then

If CBool(InStr(e.Request.Uri, "crunchyroll.com/")) And CBool(InStr(e.Request.Uri, "streams?")) Then
Debug.WriteLine("Crunchyroll-Single: " + e.Request.Uri)
'Dim ContentString As String = Nothing
'Dim Content As New MemoryStream
'e.Response.Content.CopyTo(Content)
'Content.Position = 0
'ContentString = Encoding.UTF8.GetString(Content.ToArray())
'MsgBox(ContentString)
Main.LoadedUrls.Add(e.Request.Uri)
'Main.CR_VideoJson = 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, "/objects/")) And CBool(InStr(e.Request.Uri, "/watch/")) Then
Debug.WriteLine(e.Request.Uri)
Main.LoadedUrls.Add(e.Request.Uri)
'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
Debug.WriteLine("Crunchyroll-Season: " + e.Request.Uri)
Main.LoadedUrls.Add(e.Request.Uri)
'Main.CR_SeasonJson = New UrlJson(e.Request.Uri, e.Request.Content.ToString)
Exit Sub
End If




ElseIf CBool(InStr(Main.LoadingUrl, "funimation.com")) Then
If CBool(InStr(e.Request.Uri, "?deviceType=web")) Then
Expand Down
12 changes: 6 additions & 6 deletions Crunchyroll Downloader/Main.designer.vb

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Loading

0 comments on commit e76ad3b

Please sign in to comment.