From 50a2656dff916783f5d8884503795212c3261b96 Mon Sep 17 00:00:00 2001 From: hama3254 <52826614+hama3254@users.noreply.github.com> Date: Sun, 5 Mar 2023 12:59:54 +0100 Subject: [PATCH] added very basic suport for musicvideos/concerts added very basic suport for musicvideos/concerts #704 --- .vs/Crunchyroll Downloader/v17/.suo | Bin 199680 -> 187392 bytes Crunchyroll Downloader/Main.vb | 357 +++++++++++------- .../My Project/AssemblyInfo.vb | 4 +- 3 files changed, 220 insertions(+), 141 deletions(-) diff --git a/.vs/Crunchyroll Downloader/v17/.suo b/.vs/Crunchyroll Downloader/v17/.suo index 373bd8dabd4c25467346903d762e8d4f57b6d479..137786dcb9c1813dcc79d2592fe1a94a7b82a27a 100644 GIT binary patch delta 9733 zcmeI23sltCoyX^Q8DKy}-XQWA2qNMP4i9-Kfj1fod7kTups zV{~r9O{`HfanYbP!WhOTR>wzeR=cfQV;Y+pwVuYhS<_@S4>v-;cNh>9cWru3PS0-t zoX_0*zmMO&|KH=@{{!=@KIXms))|H}mFw_Rsg@(_0opq{I%KIE(1QoTG=9)4x20kp zS=a>9@fa5Ed;at^$D@-zqB>MNT6it1rK9{htM^!og6F+>ty^vX2vVu8OvE{k5Kihr z^-mxd1cCv^=}1Rf0~UZRFbv!e!axQn1p`11cm#|9USJUz0wTe1kN~tG1&ji27&#v4 z10WFjB&7eXQl+Z~A=3}Y!R3_>ME)jH36!7;1Zltnokk<|1$q3WCNOIua-qNg{J|9P z49Evhg2{l;3xYbzk-rc81yn(Ip)twGN$two!ANs~kL&znq!Cb0;Q9)m`XX1MY$%Ts z*LgP5xxf=BpbX3hKLRH35ts_x!BTJqbV}&xSc3e2f|0H=X%bo2-<8UID)LXORQ*-; z$VkncM0(5ICr+>Z-^^X#)7(;|JdBVcbt@(IJi44fgZiFMAlv*;P9W?1asm`bb&P{B zE$Gt=_M}nF1@pt*>NsCQ#zZxcsY_hq$79(neWRH z#-gsPEt>EFYWI6_i=pVIfV;Vc8g+k%TMX>w77bW8Rs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NMKOa!Yb+;nv|$B?4yRSIVpQT9)in5Q(uq8k~NmG}$^%~aJ^ zE9N9-_CRA&jv;BR#hYaRy2hkj{?m-a7FUYCY+^20^d>5<+ZbW_~w?^AFN$N1dVs+QnscHCrV$iP9b1Ip| zDR3`2l9RQ00aWUIs&1Raq7=k$c<`|M?qOlZQ#!{Ub+{*ZfN#RXkrWlq*RDV7?i6LQ zf*=O5XgAjx8b)$79*$=;A&X|5E_8RC(PCLRAvdha%J?Kzi`ATle*Hy2M53-iLX7!2 zEXN_T|Ah}2J!+=9x|Z)$%Xi9FN0A6JRIc`W-tO*2!RFs%nSZfzl)|w16>QN6ZyQSo z(Y9u%mKHQp)#-6J$9>eXFM~G|TerLhNybFky24_py zD*kOkh~YP)a&qe!(Y*KgCoz#|cUIQ!y|0(;6SIT;FrIFS^2L`Jn^<2gk>7+jx813P zu=GF@>fl(0dl~NQP;>pe)39eoFu7v{{kkE;RCcH12U&Gn`Y&jpsoj~l`U)8d`kBUO zbqFJwf;9k5?#?FS?j?j!@Ag=>LPmUV*lu1y;q$LcH*7cC_!ntQnq=N@D__%Y#$VHJ zxKWPzfj#{sZKo&79-*5nWNd913IA1;-2-JLX7UB(Vg3!?^tgu9II*-sBB8=cu}Qjt zTy*QghYULFuqX2@Cn}RUk_gbfg#@rw^<+8!#}HFT9?`&$@(5*d4-pN25ozjJLp09x zcv-kycA0jUQ1hGev A3;+NC diff --git a/Crunchyroll Downloader/Main.vb b/Crunchyroll Downloader/Main.vb index b0e85c6..5f63fb4 100644 --- a/Crunchyroll Downloader/Main.vb +++ b/Crunchyroll Downloader/Main.vb @@ -1230,15 +1230,7 @@ Public Class Main Return Nothing 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_AuthToken = " -H " + Chr(34) + "Authorization: " + AuthToken + Chr(34) @@ -1247,85 +1239,144 @@ Public Class Main Loc_AuthToken = AuthToken End If + Dim CR_EpisodeID As String = "" - ObjectJson = CurlAuth(ObjectsURL, Loc_CR_Cookies, Loc_AuthToken) + 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 = Curl(ObjectsURL) - 'MsgBox(ObjectJson) - - If CBool(InStr(ObjectJson, "curl:")) = True Then ObjectJson = CurlAuth(ObjectsURL, Loc_CR_Cookies, Loc_AuthToken) - End If + + '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) - If CBool(InStr(ObjectJson, "curl:")) = True And CBool(InStr(CR_ObjectsJson.Url, ObjectsURLBuilder4(0))) Then - Debug.WriteLine("curl error, using CR_ObjectsJson " + vbNewLine + ObjectJson) + Else - ObjectJson = CR_ObjectsJson.Content - CR_ObjectsJson = New UrlJson("", "") - ElseIf CBool(InStr(ObjectJson, "curl:")) Then - Throw New System.Exception("Error - Getting ObjectJson data" + vbNewLine + ObjectJson) + 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) - 'MsgBox("Error - Getting ObjectJson data" + vbNewLine + ObjectJson) - 'Exit Sub - End If + CR_EpisodeID = ObjectsURLBuilder4(0) + + Debug.WriteLine(ObjectsURL) + + + ObjectJson = CurlAuth(ObjectsURL, Loc_CR_Cookies, Loc_AuthToken) - 'Filter JSON esqaped characters - 'Debug.WriteLine(Date.Now.ToString + "before:" + ObjectJson) - Debug.WriteLine("1288: " + ObjectJson) - ObjectJson = CleanJSON(ObjectJson) - 'Debug.WriteLine(Date.Now.ToString + "after:" + ObjectJson) + 'ObjectJson = Curl(ObjectsURL) - Dim ser As JObject = JObject.Parse(ObjectJson) - Dim data As List(Of JToken) = ser.Children().ToList + 'MsgBox(ObjectJson) - For Each item As JProperty In data - item.CreateReader() - Select Case item.Name + If CBool(InStr(ObjectJson, "curl:")) = True Then + ObjectJson = CurlAuth(ObjectsURL, Loc_CR_Cookies, Loc_AuthToken) + End If - Case "data" 'each record is inside the entries array - For Each Entry As JObject In item.Values - Try - Dim Title As String = Entry("title").ToString - CR_title = String.Join(" ", Title.Split(invalids, StringSplitOptions.RemoveEmptyEntries)).TrimEnd("."c).Replace(Chr(34), "").Replace("\", "").Replace("/", "").Replace(":", "") - Debug.WriteLine(Date.Now.ToString + " CR-Title: " + CR_title) - Catch ex As Exception - End Try - Dim SubData As List(Of JToken) = Entry.Children().ToList - For Each SubItem As JProperty In SubData - 'SubItem.CreateReader() - Select Case SubItem.Name - Case "episode_metadata" - For Each SubEntry As JProperty In SubItem.Values - Select Case SubEntry.Name - Case "series_title" - CR_series_title = SubEntry.Value.ToString.Replace(Chr(34), "").Replace("\", "").Replace("/", "").Replace(":", "") + + + If CBool(InStr(ObjectJson, "curl:")) = True And CBool(InStr(CR_ObjectsJson.Url, ObjectsURLBuilder4(0))) Then + Debug.WriteLine("curl error, using CR_ObjectsJson " + vbNewLine + ObjectJson) + + ObjectJson = CR_ObjectsJson.Content + CR_ObjectsJson = New UrlJson("", "") + ElseIf CBool(InStr(ObjectJson, "curl:")) Then + + Throw New System.Exception("Error - Getting ObjectJson data" + vbNewLine + ObjectJson) + + 'MsgBox("Error - Getting ObjectJson data" + vbNewLine + ObjectJson) + 'Exit Sub + End If + + + + 'Filter JSON esqaped characters + 'Debug.WriteLine(Date.Now.ToString + "before:" + ObjectJson) + Debug.WriteLine("1288: " + ObjectJson) + ObjectJson = CleanJSON(ObjectJson) + 'Debug.WriteLine(Date.Now.ToString + "after:" + ObjectJson) + + Dim ser As JObject = JObject.Parse(ObjectJson) + Dim data As List(Of JToken) = ser.Children().ToList + + For Each item As JProperty In data + item.CreateReader() + Select Case item.Name + + Case "data" 'each record is inside the entries array + For Each Entry As JObject In item.Values + Try + Dim Title As String = Entry("title").ToString + CR_title = String.Join(" ", Title.Split(invalids, StringSplitOptions.RemoveEmptyEntries)).TrimEnd("."c).Replace(Chr(34), "").Replace("\", "").Replace("/", "").Replace(":", "") + Debug.WriteLine(Date.Now.ToString + " CR-Title: " + CR_title) + Catch ex As Exception + End Try + Dim SubData As List(Of JToken) = Entry.Children().ToList + For Each SubItem As JProperty In SubData + 'SubItem.CreateReader() + Select Case SubItem.Name + Case "episode_metadata" + For Each SubEntry As JProperty In SubItem.Values + Select Case SubEntry.Name + Case "series_title" + CR_series_title = SubEntry.Value.ToString.Replace(Chr(34), "").Replace("\", "").Replace("/", "").Replace(":", "") 'Case "season_title" ' CR_season_title = SubEntry.Value.ToString - Case "season_number" - CR_season_number = SubEntry.Value.ToString.Replace(Chr(34), "").Replace("\", "").Replace("/", "").Replace(":", "") - Case "episode_number" - CR_episode2 = SubEntry.Value.ToString.Replace(Chr(34), "").Replace("\", "").Replace("/", "").Replace(":", "") - Case "episode" - CR_episode = SubEntry.Value.ToString.Replace(Chr(34), "").Replace("\", "").Replace("/", "").Replace(":", "") - Case "duration_ms" - CR_episode_duration_ms = SubEntry.Value.ToString.Replace(Chr(34), "").Replace("\", "").Replace("/", "").Replace(":", "") - Case "is_dubbed" - CR_audio_isDubbed = CBool(SubEntry.Value.ToString.Replace(Chr(34), "").Replace("\", "").Replace("/", "").Replace(":", "")) - End Select - Next ' - End Select + Case "season_number" + CR_season_number = SubEntry.Value.ToString.Replace(Chr(34), "").Replace("\", "").Replace("/", "").Replace(":", "") + Case "episode_number" + CR_episode2 = SubEntry.Value.ToString.Replace(Chr(34), "").Replace("\", "").Replace("/", "").Replace(":", "") + Case "episode" + CR_episode = SubEntry.Value.ToString.Replace(Chr(34), "").Replace("\", "").Replace("/", "").Replace(":", "") + Case "duration_ms" + CR_episode_duration_ms = SubEntry.Value.ToString.Replace(Chr(34), "").Replace("\", "").Replace("/", "").Replace(":", "") + Case "is_dubbed" + CR_audio_isDubbed = CBool(SubEntry.Value.ToString.Replace(Chr(34), "").Replace("\", "").Replace("/", "").Replace(":", "")) + End Select + Next ' + End Select + Next Next - Next - End Select - Next + End Select + Next + + End If #Region "VideoJson" Dim VideoJson As String = Nothing @@ -1341,12 +1392,12 @@ Public Class Main End If - 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 StreamsUrlBuilder() As String = ObjectJson.Split(New String() {"videos/"}, 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) VideoJson = CR_VideoJson.Content CR_VideoJson = New UrlJson("", "") @@ -1625,79 +1676,85 @@ Public Class Main #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_Chapters = True Then + If CR_EpisodeID = "" Then + 'ignore for music video + Else - Dim ChaptersUrl As String = "https://static.crunchyroll.com/datalab-intro-v2/" + ObjectsURLBuilder4(0) + ".json" - Dim ChaptersJson As String = Nothing + If CR_Chapters = True Then - ChaptersJson = Curl(ChaptersUrl) + Dim ChaptersUrl As String = "https://static.crunchyroll.com/datalab-intro-v2/" + CR_EpisodeID + ".json" + Dim ChaptersJson As String = Nothing + - If CBool(InStr(ChaptersJson, "curl:")) = True Then ChaptersJson = Curl(ChaptersUrl) - End If - If CBool(InStr(ChaptersJson, "curl:")) = True Then - ChaptersJson = Nothing - Debug.WriteLine("no Chapter data... ignoring") - End If - If ChaptersJson IsNot Nothing Then + If CBool(InStr(ChaptersJson, "curl:")) = True Then + ChaptersJson = Curl(ChaptersUrl) + End If - Dim StartTime As String() = ChaptersJson.Split(New String() {Chr(34) + "startTime" + Chr(34) + ": "}, System.StringSplitOptions.RemoveEmptyEntries) - Dim StartTime2 As String() = StartTime(1).Split(New String() {","}, System.StringSplitOptions.RemoveEmptyEntries) - Dim StartTime3 As String() = StartTime2(0).Split(New String() {"."}, System.StringSplitOptions.RemoveEmptyEntries) - Dim StartTime4 As String = StartTime3(1) + If CBool(InStr(ChaptersJson, "curl:")) = True Then + ChaptersJson = Nothing + Debug.WriteLine("no Chapter data... ignoring") + End If + If ChaptersJson IsNot Nothing Then - For i As Integer = StartTime4.Length To 2 - StartTime4 = StartTime4 + "0" - Next + Dim StartTime As String() = ChaptersJson.Split(New String() {Chr(34) + "startTime" + Chr(34) + ": "}, System.StringSplitOptions.RemoveEmptyEntries) + Dim StartTime2 As String() = StartTime(1).Split(New String() {","}, System.StringSplitOptions.RemoveEmptyEntries) + Dim StartTime3 As String() = StartTime2(0).Split(New String() {"."}, System.StringSplitOptions.RemoveEmptyEntries) + Dim StartTime4 As String = StartTime3(1) - Dim StartTime_ms As String = StartTime3(0) + StartTime4 + For i As Integer = StartTime4.Length To 2 + StartTime4 = StartTime4 + "0" + Next + + Dim StartTime_ms As String = StartTime3(0) + StartTime4 - Dim EndTime As String() = ChaptersJson.Split(New String() {Chr(34) + "endTime" + Chr(34) + ": "}, System.StringSplitOptions.RemoveEmptyEntries) - Dim EndTime2 As String() = EndTime(1).Split(New String() {","}, System.StringSplitOptions.RemoveEmptyEntries) - Dim EndTime3 As String() = EndTime2(0).Split(New String() {"."}, System.StringSplitOptions.RemoveEmptyEntries) + Dim EndTime As String() = ChaptersJson.Split(New String() {Chr(34) + "endTime" + Chr(34) + ": "}, System.StringSplitOptions.RemoveEmptyEntries) + Dim EndTime2 As String() = EndTime(1).Split(New String() {","}, System.StringSplitOptions.RemoveEmptyEntries) + Dim EndTime3 As String() = EndTime2(0).Split(New String() {"."}, System.StringSplitOptions.RemoveEmptyEntries) - Dim EndTime4 As String = EndTime3(1) - Dim AfterTime As String = Nothing + Dim EndTime4 As String = EndTime3(1) + Dim AfterTime As String = Nothing + + For i As Integer = EndTime4.Length To 2 + If EndTime4.Length = 2 Then + AfterTime = EndTime4 + "1" + End If + EndTime4 = EndTime4 + "0" + Next + + Dim EndTime_ms As String = EndTime3(0) + EndTime4 + Dim AfterTime_ms As String = EndTime3(0) + AfterTime + Dim Metadata As String = Nothing + + If CInt(CR_episode_duration_ms) < CInt(StartTime_ms) Then + 'Totaly invalid... + ElseIf CInt(CR_episode_duration_ms) < CInt(EndTime_ms) Then + 'it's not an Intro it's an outro + Dim DeCh As Integer = CInt(StartTime_ms) - 1 + Metadata = My.Resources.ffmpeg_metadata_out.Replace("[Titel]", CR_FilenName).Replace("[Start-1]", DeCh.ToString).Replace("[Start]", StartTime_ms).Replace("[duration_ms]", CR_episode_duration_ms) + + Else + Metadata = My.Resources.ffmpeg_metadata.Replace("[Titel]", CR_FilenName).Replace("[Start]", StartTime_ms).Replace("[END]", EndTime_ms).Replace("[after]", AfterTime_ms).Replace("[duration_ms]", CR_episode_duration_ms) - For i As Integer = EndTime4.Length To 2 - If EndTime4.Length = 2 Then - AfterTime = EndTime4 + "1" End If - EndTime4 = EndTime4 + "0" - Next - Dim EndTime_ms As String = EndTime3(0) + EndTime4 - Dim AfterTime_ms As String = EndTime3(0) + AfterTime - Dim Metadata As String = Nothing + If Metadata = Nothing Then + Else + Dim utf8WithoutBom2 As New System.Text.UTF8Encoding(False) + Using sink As New StreamWriter(Mdata_File, False, utf8WithoutBom2) + sink.WriteLine(Metadata) + CR_MetadataUsage = True + End Using + End If - If CInt(CR_episode_duration_ms) < CInt(StartTime_ms) Then - 'Totaly invalid... - ElseIf CInt(CR_episode_duration_ms) < CInt(EndTime_ms) Then - 'it's not an Intro it's an outro - Dim DeCh As Integer = CInt(StartTime_ms) - 1 - Metadata = My.Resources.ffmpeg_metadata_out.Replace("[Titel]", CR_FilenName).Replace("[Start-1]", DeCh.ToString).Replace("[Start]", StartTime_ms).Replace("[duration_ms]", CR_episode_duration_ms) - - Else - Metadata = My.Resources.ffmpeg_metadata.Replace("[Titel]", CR_FilenName).Replace("[Start]", StartTime_ms).Replace("[END]", EndTime_ms).Replace("[after]", AfterTime_ms).Replace("[duration_ms]", CR_episode_duration_ms) End If - - If Metadata = Nothing Then - Else - Dim utf8WithoutBom2 As New System.Text.UTF8Encoding(False) - Using sink As New StreamWriter(Mdata_File, False, utf8WithoutBom2) - sink.WriteLine(Metadata) - CR_MetadataUsage = True - End Using - End If - - End If End If #End Region @@ -1783,6 +1840,7 @@ Public Class Main For i As Integer = 0 To CR_URI_Master.Count - 1 + str = Curl(CR_URI_Master(i)) If CBool(InStr(str, "curl:")) = False Then @@ -1793,7 +1851,11 @@ Public Class Main 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) + Grapp_RDY = True + Exit Sub + ElseIf DownloadScope = DownloadScopeEnum.AudioOnly Or MergeAudio = True Then If CBool(InStr(str, "x480,")) Then @@ -1972,24 +2034,29 @@ Public Class Main #End Region #Region "thumbnail" - Dim thumbnail As String() = ObjectJson.Split(New String() {"https://"}, System.StringSplitOptions.RemoveEmptyEntries) Dim thumbnail3 As String = "" - For i As Integer = 0 To thumbnail.Count - 1 - 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]() {"-"}) - thumbnail3 = "https://" + thumbnail2(0).Replace("\/", "/") + ".jpg" - Exit For - ElseIf CBool(InStr(thumbnail(i), ".jpeg" + Chr(34))) Then - Dim thumbnail2 As String() = thumbnail(i).Split(New String() {".jpeg" + Chr(34)}, System.StringSplitOptions.RemoveEmptyEntries) '(New [Char]() {"-"}) - thumbnail3 = "https://" + thumbnail2(0).Replace("\/", "/") + ".jpeg" - Exit For - ElseIf CBool(InStr(thumbnail(i), ".jpe" + Chr(34))) Then - Dim thumbnail2 As String() = thumbnail(i).Split(New String() {".jpe" + Chr(34)}, System.StringSplitOptions.RemoveEmptyEntries) '(New [Char]() {"-"}) - thumbnail3 = "https://" + thumbnail2(0).Replace("\/", "/") + ".jpe" - Exit For - End If - Next + Try + Dim thumbnail As String() = ObjectJson.Split(New String() {"https://"}, System.StringSplitOptions.RemoveEmptyEntries) + For i As Integer = 0 To thumbnail.Count - 1 + 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]() {"-"}) + thumbnail3 = "https://" + thumbnail2(0).Replace("\/", "/") + ".jpg" + Exit For + ElseIf CBool(InStr(thumbnail(i), ".jpeg" + Chr(34))) Then + Dim thumbnail2 As String() = thumbnail(i).Split(New String() {".jpeg" + Chr(34)}, System.StringSplitOptions.RemoveEmptyEntries) '(New [Char]() {"-"}) + thumbnail3 = "https://" + thumbnail2(0).Replace("\/", "/") + ".jpeg" + Exit For + ElseIf CBool(InStr(thumbnail(i), ".jpe" + Chr(34))) Then + Dim thumbnail2 As String() = thumbnail(i).Split(New String() {".jpe" + Chr(34)}, System.StringSplitOptions.RemoveEmptyEntries) '(New [Char]() {"-"}) + thumbnail3 = "https://" + thumbnail2(0).Replace("\/", "/") + ".jpe" + Exit For + End If + Next + + Catch ex As Exception + + End Try #End Region #Region "item constructor" @@ -4509,6 +4576,8 @@ Public Class Main Else Url_locale = locale2(0) End If + + ElseIf CBool(InStr(Url, "/watch")) Then 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) @@ -4521,6 +4590,16 @@ Public Class Main Else Url_locale = locale2(0) 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 Debug.WriteLine("###" + CR_Cookies + "###") diff --git a/Crunchyroll Downloader/My Project/AssemblyInfo.vb b/Crunchyroll Downloader/My Project/AssemblyInfo.vb index 78a5242..aa24f82 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: ' - - + +