added musicvideo/concert api calls

added musicvideo/concert api calls #797
This commit is contained in:
hama3254 2023-08-10 13:16:55 +02:00
parent 2dd509614a
commit 9cdaaa49ce
4 changed files with 131 additions and 19 deletions

Binary file not shown.

View File

@ -21,6 +21,7 @@ Public Class Browser
Try Try
WebView2.CoreWebView2.AddWebResourceRequestedFilter("https://www.crunchyroll.com/*", CoreWebView2WebResourceContext.All) WebView2.CoreWebView2.AddWebResourceRequestedFilter("https://www.crunchyroll.com/*", CoreWebView2WebResourceContext.All)
WebView2.CoreWebView2.AddWebResourceRequestedFilter("https://www.funimation.com/*", CoreWebView2WebResourceContext.All) WebView2.CoreWebView2.AddWebResourceRequestedFilter("https://www.funimation.com/*", CoreWebView2WebResourceContext.All)
' WebView2.CoreWebView2.AddWebResourceRequestedFilter("*", CoreWebView2WebResourceContext.All)
'WebView2.CoreWebView2.AddWebResourceRequestedFilter("*", CoreWebView2WebResourceContext.All) 'WebView2.CoreWebView2.AddWebResourceRequestedFilter("*", CoreWebView2WebResourceContext.All)
AddHandler WebView2.CoreWebView2.WebResourceResponseReceived, AddressOf ObserveResponse AddHandler WebView2.CoreWebView2.WebResourceResponseReceived, AddressOf ObserveResponse
@ -269,6 +270,8 @@ Public Class Browser
Private Sub ObserveHttp(ByVal sender As Object, ByVal e As CoreWebView2WebResourceRequestedEventArgs) 'Handles RequestResource.GetUrl Private Sub ObserveHttp(ByVal sender As Object, ByVal e As CoreWebView2WebResourceRequestedEventArgs) 'Handles RequestResource.GetUrl
' Debug.WriteLine(e.Request.Uri)
If CBool(InStr(e.Request.Uri, "crunchyroll.com")) = True And Main.CrBetaBasic = Nothing Then If CBool(InStr(e.Request.Uri, "crunchyroll.com")) = True And Main.CrBetaBasic = Nothing Then
Dim Headers As New List(Of KeyValuePair(Of String, String)) Dim Headers As New List(Of KeyValuePair(Of String, String))
Headers.AddRange(e.Request.Headers.ToList) Headers.AddRange(e.Request.Headers.ToList)
@ -296,13 +299,13 @@ Public Class Browser
' '
' '
If CBool(InStr(e.Request.Uri, "9016.2bd48f1e07adf6596b2d.js")) = True Then ' 'If CBool(InStr(e.Request.Uri, "9016.2bd48f1e07adf6596b2d.js")) = True Then '
Debug.WriteLine(e.Request.Uri) ' Debug.WriteLine(e.Request.Uri)
'MsgBox("Found!") ' 'MsgBox("Found!")
e.Response = WebView2.CoreWebView2.Environment.CreateWebResourceResponse(StringToStream(File.ReadAllText(Application.StartupPath + "\WebInterface\9016.2bd48f1e07adf6596b2d.js"), Encoding.UTF8), 200, "Not found", "content-type: application/javascript") ' e.Response = WebView2.CoreWebView2.Environment.CreateWebResourceResponse(StringToStream(File.ReadAllText(Application.StartupPath + "\WebInterface\9016.2bd48f1e07adf6596b2d.js"), Encoding.UTF8), 200, "Not found", "content-type: application/javascript")
End If 'End If
End Sub End Sub

View File

@ -4459,18 +4459,19 @@ Public Class Main
Url_locale = locale2(0) Url_locale = locale2(0)
End If End If
If CBool(InStr(Url, "musicvideo/")) Then 'If CBool(InStr(Url, "musicvideo/")) Then
SetStatusLabel("Status: musicvideo detected - partial support only") ' SetStatusLabel("Status: musicvideo detected - partial support only")
Browser.WebView2.CoreWebView2.Navigate(Url) ' Browser.WebView2.CoreWebView2.Navigate(Url)
Exit Sub ' Exit Sub
ElseIf CBool(InStr(Url, "/concert/")) Then 'Else
'If CBool(InStr(Url, "/concert/")) Then
SetStatusLabel("Status: concert detected - partial support only") ' SetStatusLabel("Status: concert detected - partial support only")
Browser.WebView2.CoreWebView2.Navigate(Url) ' Browser.WebView2.CoreWebView2.Navigate(Url)
Exit Sub ' Exit Sub
End If ' End If
End If End If
@ -4495,8 +4496,9 @@ Public Class Main
If CBool(InStr(v1Token, "curl:")) = True And CBool(InStr(v1Token, "400")) = True Then If CBool(InStr(v1Token, "curl:")) = True And CBool(InStr(v1Token, "400")) = True Then
Debug.WriteLine("Post error!, 400")
v1Token = CurlPost("https://www.crunchyroll.com/auth/v1/token", Loc_CR_Cookies, Auth, Post.Replace("etp_rt_cookie", "client_id"), "add_main-4499") Debug.WriteLine(Post.Replace("etp_rt_cookie", "client_id"))
v1Token = CurlPost("https://www.crunchyroll.com/auth/v1/token", Loc_CR_Cookies, Auth, Post.Replace("etp_rt_cookie", "client_id"), "add_main-4499")
End If End If
@ -4544,6 +4546,7 @@ Public Class Main
Public Sub ProcessLoading(ByVal url As String, Auth2 As String, ByVal Loc_CR_Cookies As String, ByVal RT_Count As Integer) Public Sub ProcessLoading(ByVal url As String, Auth2 As String, ByVal Loc_CR_Cookies As String, ByVal RT_Count As Integer)
' MsgBox(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, "series/")) = True Then
Dim SeriesUrlBuilder() As String = url.Split(New String() {"series/"}, System.StringSplitOptions.RemoveEmptyEntries) Dim SeriesUrlBuilder() As String = url.Split(New String() {"series/"}, System.StringSplitOptions.RemoveEmptyEntries)
@ -4556,7 +4559,9 @@ Public Class Main
GetBetaSeasons(url, SeriesUrl, Auth2) GetBetaSeasons(url, SeriesUrl, Auth2)
ElseIf CBool(InStr(url, "crunchyroll.com")) = True And CBool(InStr(url, "watch/")) = True And CBool(CrBetaBasic = Nothing) = False Then ElseIf CBool(InStr(url, "crunchyroll.com")) = True And CBool(InStr(url, "watch/")) = True And CBool(CrBetaBasic = Nothing) = False And CBool(InStr(url, "/musicvideo/")) = False And CBool(InStr(url, "/concert/")) = False Then
#Region "Anime"
Dim ObjectsUrl As String = Nothing Dim ObjectsUrl As String = Nothing
@ -4626,8 +4631,112 @@ Public Class Main
End Try End Try
GetCRVideoProxy(StreamsUrl, Auth2, url, RT_Count) GetCRVideoProxy(StreamsUrl, Auth2, url, RT_Count)
#End Region
ElseIf CBool(InStr(url, "crunchyroll.com")) = True And CBool(InStr(url, "musicvideo/")) = True And CBool(CrBetaBasic = Nothing) = False Then
#Region "musik videos"
Dim ObjectsUrl As String = Nothing
Dim ObjectsURLBuilder3() As String = url.Split(New String() {"musicvideo/"}, System.StringSplitOptions.RemoveEmptyEntries)
Dim ObjectsURLBuilder4() As String = ObjectsURLBuilder3(1).Split(New String() {"/"}, System.StringSplitOptions.RemoveEmptyEntries)
ObjectsUrl = "https://www.crunchyroll.com/content/v2/music/music_videos/" + ObjectsURLBuilder4(0) + "?locale=" + locale
Debug.WriteLine("ObjectsUrl: " + ObjectsUrl)
Dim StreamsUrl As String = Nothing
Dim ObjectJson As String
Try
ObjectJson = CurlAuthNew(ObjectsUrl, Loc_CR_Cookies, Auth2)
Catch ex As Exception
If CBool(InStr(ex.ToString, "Error - Getting")) Then
MsgBox("Error invalid CR respone")
Exit Sub
Else
MsgBox("Error processing data")
Exit Sub
End If
End Try
If CBool(InStr(ObjectJson, "/content/v2/music/")) = 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
'Try
Dim StreamsUrlBuilder() As String = ObjectJson.Split(New String() {"/content/v2/music/"}, System.StringSplitOptions.RemoveEmptyEntries)
Dim StreamsUrlBuilder2() As String = StreamsUrlBuilder(1).Split(New String() {"/streams"}, System.StringSplitOptions.RemoveEmptyEntries)
StreamsUrl = "https://www.crunchyroll.com/content/v2/music/" + StreamsUrlBuilder2(0) + "/streams?locale=" + locale
GetCRVideoProxy(StreamsUrl, Auth2, url, RT_Count)
#End Region
ElseIf CBool(InStr(url, "crunchyroll.com")) = True And CBool(InStr(url, "concert/")) = True And CBool(CrBetaBasic = Nothing) = False Then
Dim ObjectsUrl As String = Nothing
Dim ObjectsURLBuilder3() As String = url.Split(New String() {"concert/"}, System.StringSplitOptions.RemoveEmptyEntries)
Dim ObjectsURLBuilder4() As String = ObjectsURLBuilder3(1).Split(New String() {"/"}, System.StringSplitOptions.RemoveEmptyEntries)
ObjectsUrl = "https://www.crunchyroll.com/content/v2/music/concerts/" + ObjectsURLBuilder4(0) + "?locale=" + locale
Debug.WriteLine("ObjectsUrl: " + ObjectsUrl)
Dim StreamsUrl As String = Nothing
Dim ObjectJson As String
Try
ObjectJson = CurlAuthNew(ObjectsUrl, Loc_CR_Cookies, Auth2)
Catch ex As Exception
If CBool(InStr(ex.ToString, "Error - Getting")) Then
MsgBox("Error invalid CR respone")
Exit Sub
Else
MsgBox("Error processing data")
Exit Sub
End If
End Try
If CBool(InStr(ObjectJson, "/content/v2/music/")) = 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
'Try
Dim StreamsUrlBuilder() As String = ObjectJson.Split(New String() {"/content/v2/music/"}, System.StringSplitOptions.RemoveEmptyEntries)
Dim StreamsUrlBuilder2() As String = StreamsUrlBuilder(1).Split(New String() {"/streams"}, System.StringSplitOptions.RemoveEmptyEntries)
StreamsUrl = "https://www.crunchyroll.com/content/v2/music/" + StreamsUrlBuilder2(0) + "/streams?locale=" + locale
GetCRVideoProxy(StreamsUrl, Auth2, url, RT_Count)
Else Else
Browser.WebView2.CoreWebView2.Navigate(url) Browser.WebView2.CoreWebView2.Navigate(url)
End If End If

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.15.6")> <Assembly: AssemblyVersion("3.15.6.1")>
<Assembly: AssemblyFileVersion("3.15.6")> <Assembly: AssemblyFileVersion("3.15.6.1")>
<Assembly: NeutralResourcesLanguage("en")> <Assembly: NeutralResourcesLanguage("en")>