added very basic suport for musicvideos/concerts

added very basic suport for musicvideos/concerts #704
This commit is contained in:
hama3254 2023-03-05 12:59:54 +01:00
parent a49d3ff11b
commit 50a2656dff
3 changed files with 220 additions and 141 deletions

Binary file not shown.

View File

@ -1230,15 +1230,7 @@ Public Class Main
Return Nothing Return Nothing
End Function)) End Function))
'
Dim ObjectsURLBuilder() As String = Streams.Split(New String() {"videos"}, System.StringSplitOptions.RemoveEmptyEntries)
Dim ObjectsURLBuilder2() As String = ObjectsURLBuilder(1).Split(New String() {"/streams"}, System.StringSplitOptions.RemoveEmptyEntries)
Dim ObjectsURLBuilder3() As String = WebsiteURL.Split(New String() {"watch/"}, System.StringSplitOptions.RemoveEmptyEntries)
Dim ObjectsURLBuilder4() As String = ObjectsURLBuilder3(1).Split(New String() {"/"}, System.StringSplitOptions.RemoveEmptyEntries)
Dim ObjectsURL As String = ObjectsURLBuilder(0) + "objects/" + ObjectsURLBuilder4(0) + ObjectsURLBuilder2(1)
Debug.WriteLine(ObjectsURL)
Dim Loc_CR_Cookies = " -H " + Chr(34) + CR_Cookies + Chr(34) Dim Loc_CR_Cookies = " -H " + Chr(34) + CR_Cookies + Chr(34)
Dim Loc_AuthToken = " -H " + Chr(34) + "Authorization: " + AuthToken + Chr(34) Dim Loc_AuthToken = " -H " + Chr(34) + "Authorization: " + AuthToken + Chr(34)
@ -1247,6 +1239,63 @@ Public Class Main
Loc_AuthToken = AuthToken Loc_AuthToken = AuthToken
End If End If
Dim CR_EpisodeID As String = ""
If CBool(InStr(WebsiteURL, "musicvideo")) = True Then
'TextBox2_Text to bypasss name for now
'https://www.crunchyroll.com/content/v2/cms/objects/G69PX0W3Y?locale=de-DE
'https://www.crunchyroll.com/content/v2/cms/videos/G25FVQD3Q/streams?locale=de-DE
'https://www.crunchyroll.com/content/v2/music/MV2FD1FECE/streams?locale=de-DE
'https://www.crunchyroll.com/content/v2/music/MV2FD1FECE?locale=de-DE
'https://www.crunchyroll.com/content/v2/music/music_videos/MV2FD1FECE?locale=de-DE
Dim ObjectsURL As String = Streams.Replace("music/", "music/music_videos/").Replace("/streams", "")
ObjectJson = CurlAuth(ObjectsURL, Loc_CR_Cookies, Loc_AuthToken)
'MsgBox(ObjectsURL)
'MsgBox(ObjectJson.Length.ToString)
'MsgBox(ObjectJson)
'title":" + "
'"name":" + "
Dim Title() As String = ObjectJson.Split(New String() {Chr(34) + "title" + Chr(34) + ":" + Chr(34)}, System.StringSplitOptions.RemoveEmptyEntries)
Dim Title2() As String = Title(1).Split(New String() {Chr(34)}, System.StringSplitOptions.RemoveEmptyEntries)
Dim Arti() As String = ObjectJson.Split(New String() {Chr(34) + "name" + Chr(34) + ":" + Chr(34)}, System.StringSplitOptions.RemoveEmptyEntries)
Dim Arti2() As String = Arti(1).Split(New String() {Chr(34)}, System.StringSplitOptions.RemoveEmptyEntries)
'MsgBox(Arti2(0))
'MsgBox(Title2(0))
TextBox2_Text = Arti2(0) + " - " + Title2(0)
Else
Dim ObjectsURLBuilder() As String = Streams.Split(New String() {"videos"}, System.StringSplitOptions.RemoveEmptyEntries)
Dim ObjectsURLBuilder2() As String = ObjectsURLBuilder(1).Split(New String() {"/streams"}, System.StringSplitOptions.RemoveEmptyEntries)
Dim ObjectsURLBuilder3() As String = WebsiteURL.Split(New String() {"watch/"}, System.StringSplitOptions.RemoveEmptyEntries)
Dim ObjectsURLBuilder4() As String = ObjectsURLBuilder3(1).Split(New String() {"/"}, System.StringSplitOptions.RemoveEmptyEntries)
Dim ObjectsURL As String = ObjectsURLBuilder(0) + "objects/" + ObjectsURLBuilder4(0) + ObjectsURLBuilder2(1)
CR_EpisodeID = ObjectsURLBuilder4(0)
Debug.WriteLine(ObjectsURL)
ObjectJson = CurlAuth(ObjectsURL, Loc_CR_Cookies, Loc_AuthToken) ObjectJson = CurlAuth(ObjectsURL, Loc_CR_Cookies, Loc_AuthToken)
@ -1327,6 +1376,8 @@ Public Class Main
End Select End Select
Next Next
End If
#Region "VideoJson" #Region "VideoJson"
Dim VideoJson As String = Nothing Dim VideoJson As String = Nothing
@ -1341,12 +1392,12 @@ Public Class Main
End If End If
Dim StreamsUrlBuilder() As String = ObjectJson.Split(New String() {"videos/"}, System.StringSplitOptions.RemoveEmptyEntries) '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 StreamsUrlBuilder2() As String = StreamsUrlBuilder(1).Split(New String() {"/streams"}, System.StringSplitOptions.RemoveEmptyEntries)
If CBool(InStr(VideoJson, "curl:")) = True And CBool(InStr(CR_VideoJson.Url, StreamsUrlBuilder2(0))) Then If CBool(InStr(VideoJson, "curl:")) = True Then 'And CBool(InStr(CR_VideoJson.Url, StreamsUrlBuilder2(0))) Then
Debug.WriteLine("curl error, using CR_VideoJson " + vbNewLine + VideoJson) Debug.WriteLine("curl error, using CR_VideoJson " + vbNewLine + VideoJson)
VideoJson = CR_VideoJson.Content VideoJson = CR_VideoJson.Content
CR_VideoJson = New UrlJson("", "") CR_VideoJson = New UrlJson("", "")
@ -1625,12 +1676,17 @@ Public Class Main
#Region "Chapters" #Region "Chapters"
Dim Mdata_File As String = Application.StartupPath + "\" + ObjectsURLBuilder4(0) + "-mdata.txt" Dim Mdata_File As String = Application.StartupPath + "\" + CR_EpisodeID + "-mdata.txt"
If CR_EpisodeID = "" Then
'ignore for music video
Else
If CR_Chapters = True Then If CR_Chapters = True Then
Dim ChaptersUrl As String = "https://static.crunchyroll.com/datalab-intro-v2/" + ObjectsURLBuilder4(0) + ".json" Dim ChaptersUrl As String = "https://static.crunchyroll.com/datalab-intro-v2/" + CR_EpisodeID + ".json"
Dim ChaptersJson As String = Nothing Dim ChaptersJson As String = Nothing
@ -1698,6 +1754,7 @@ Public Class Main
End If End If
End If
End If End If
End If End If
#End Region #End Region
@ -1783,6 +1840,7 @@ Public Class Main
For i As Integer = 0 To CR_URI_Master.Count - 1 For i As Integer = 0 To CR_URI_Master.Count - 1
str = Curl(CR_URI_Master(i)) str = Curl(CR_URI_Master(i))
If CBool(InStr(str, "curl:")) = False Then If CBool(InStr(str, "curl:")) = False Then
@ -1793,7 +1851,11 @@ Public Class Main
If CBool(InStr(str, "curl:")) = True Then If CBool(InStr(str, "curl:")) = True Then
Debug.WriteLine("Checked " + CR_URI_Master.Count.ToString)
MsgBox("Unable to get master.m3u8" + vbNewLine + str, MsgBoxStyle.Critical) MsgBox("Unable to get master.m3u8" + vbNewLine + str, MsgBoxStyle.Critical)
Grapp_RDY = True
Exit Sub
ElseIf DownloadScope = DownloadScopeEnum.AudioOnly Or MergeAudio = True Then ElseIf DownloadScope = DownloadScopeEnum.AudioOnly Or MergeAudio = True Then
If CBool(InStr(str, "x480,")) Then If CBool(InStr(str, "x480,")) Then
@ -1972,8 +2034,10 @@ Public Class Main
#End Region #End Region
#Region "thumbnail" #Region "thumbnail"
Dim thumbnail As String() = ObjectJson.Split(New String() {"https://"}, System.StringSplitOptions.RemoveEmptyEntries)
Dim thumbnail3 As String = "" Dim thumbnail3 As String = ""
Try
Dim thumbnail As String() = ObjectJson.Split(New String() {"https://"}, System.StringSplitOptions.RemoveEmptyEntries)
For i As Integer = 0 To thumbnail.Count - 1 For i As Integer = 0 To thumbnail.Count - 1
If CBool(InStr(thumbnail(i), ".jpg" + Chr(34))) Then If CBool(InStr(thumbnail(i), ".jpg" + Chr(34))) Then
Dim thumbnail2 As String() = thumbnail(i).Split(New String() {".jpg" + Chr(34)}, System.StringSplitOptions.RemoveEmptyEntries) '(New [Char]() {"-"}) Dim thumbnail2 As String() = thumbnail(i).Split(New String() {".jpg" + Chr(34)}, System.StringSplitOptions.RemoveEmptyEntries) '(New [Char]() {"-"})
@ -1990,6 +2054,9 @@ Public Class Main
End If End If
Next Next
Catch ex As Exception
End Try
#End Region #End Region
#Region "item constructor" #Region "item constructor"
@ -4509,6 +4576,8 @@ Public Class Main
Else Else
Url_locale = locale2(0) Url_locale = locale2(0)
End If End If
ElseIf CBool(InStr(Url, "/watch")) Then ElseIf CBool(InStr(Url, "/watch")) Then
Dim locale1() As String = Url.Split(New String() {"crunchyroll.com/"}, System.StringSplitOptions.RemoveEmptyEntries) Dim locale1() As String = Url.Split(New String() {"crunchyroll.com/"}, System.StringSplitOptions.RemoveEmptyEntries)
Dim locale2() As String = locale1(1).Split(New String() {"/watch"}, System.StringSplitOptions.RemoveEmptyEntries) Dim locale2() As String = locale1(1).Split(New String() {"/watch"}, System.StringSplitOptions.RemoveEmptyEntries)
@ -4521,6 +4590,16 @@ Public Class Main
Else Else
Url_locale = locale2(0) Url_locale = locale2(0)
End If End If
If CBool(InStr(Url, "musicvideo/")) Then
SetStatusLabel("Status: musicvideo detected - partial support only")
Browser.WebView2.CoreWebView2.Navigate(Url)
Exit Sub
End If
End If End If
Debug.WriteLine("###" + CR_Cookies + "###") Debug.WriteLine("###" + CR_Cookies + "###")

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.14.3")> <Assembly: AssemblyVersion("3.14.5")>
<Assembly: AssemblyFileVersion("3.14.3")> <Assembly: AssemblyFileVersion("3.14.5")>
<Assembly: NeutralResourcesLanguage("en")> <Assembly: NeutralResourcesLanguage("en")>