change api

changed the api to another version (yt-dlp)
This commit is contained in:
hama3254 2023-12-15 16:53:07 +01:00
parent cff2f6c926
commit cfb3f41700
5 changed files with 126 additions and 80 deletions

Binary file not shown.

View File

@ -30,6 +30,8 @@ Public Class Browser
' '
'WebView2.CoreWebView2.Settings.UserAgent = "Mozilla/5.0 (Windows NT 10.0; Trident/7.0; rv:11.0) like Gecko" 'WebView2.CoreWebView2.Settings.UserAgent = "Mozilla/5.0 (Windows NT 10.0; Trident/7.0; rv:11.0) like Gecko"
My.Settings.User_Agend = Chr(34) + "User-Agent: " + WebView2.CoreWebView2.Settings.UserAgent + Chr(34) My.Settings.User_Agend = Chr(34) + "User-Agent: " + WebView2.CoreWebView2.Settings.UserAgent + Chr(34)
'My.Settings.User_Agend = Chr(34) + "User-Agent: " + "Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:120.0) Gecko/20100101 Firefox/120.0" + Chr(34)
'MsgBox(My.Settings.User_Agend) 'MsgBox(My.Settings.User_Agend)
If WebView2.CoreWebView2.Source = "about:blank" Or WebView2.CoreWebView2.Source = Nothing Then If WebView2.CoreWebView2.Source = "about:blank" Or WebView2.CoreWebView2.Source = Nothing Then

View File

@ -126,7 +126,7 @@ Public Class Main
Public LangValueEnum As New List(Of NameValuePair) Public LangValueEnum As New List(Of NameValuePair)
Public DubSprache As NameValuePair = New NameValuePair("Japanese", "jpn", "ja-JP", Nothing) Public DubSprache As NameValuePair = New NameValuePair("Japanese", "jpn", "ja-JP", Nothing)
Public SubSprache As NameValuePair = New NameValuePair("[ null ]", "", "", Nothing) Public SubSprache As NameValuePair = New NameValuePair("[ null ]", "", "null", Nothing)
Public SoftSubs As New List(Of String) Public SoftSubs As New List(Of String)
Public IncludeLangName As Boolean = False Public IncludeLangName As Boolean = False
@ -977,8 +977,9 @@ Public Class Main
Dim CR_Anime_Staffel_int As String = Nothing Dim CR_Anime_Staffel_int As String = Nothing
Dim CR_episode_int As String = Nothing Dim CR_episode_int As String = Nothing
Dim CR_title As String = Nothing Dim CR_title As String = Nothing
Dim CR_audio_locale As String = Nothing Dim CR_audio_locale As String = "ja-JP"
Dim CR_audio_isDubbed As Boolean = False Dim CR_audio_isDubbed As Boolean = False
Dim CR_Region As String = "DE"
Dim ResoUsed As String = "x" + Reso.ToString Dim ResoUsed As String = "x" + Reso.ToString
Dim ffmpegInput As String = "-i [Subtitles only]" Dim ffmpegInput As String = "-i [Subtitles only]"
@ -1097,6 +1098,8 @@ Public Class Main
CR_episode_duration_ms = SubEntry.Value.ToString.Replace(Chr(34), "").Replace("\", "").Replace("/", "").Replace(":", "") CR_episode_duration_ms = SubEntry.Value.ToString.Replace(Chr(34), "").Replace("\", "").Replace("/", "").Replace(":", "")
Case "is_dubbed" Case "is_dubbed"
CR_audio_isDubbed = CBool(SubEntry.Value.ToString.Replace(Chr(34), "").Replace("\", "").Replace("/", "").Replace(":", "")) CR_audio_isDubbed = CBool(SubEntry.Value.ToString.Replace(Chr(34), "").Replace("\", "").Replace("/", "").Replace(":", ""))
'Case "eligible_region"
' CR_Region = SubEntry.Value.ToString.Replace(Chr(34), "").Replace("\", "").Replace("/", "").Replace(":", "")
End Select End Select
Next ' Next '
End Select End Select
@ -1108,11 +1111,39 @@ Public Class Main
End If End If
#Region "VideoJson" #Region "VideoJson"
Dim cms As String = CurlAuthNew("https://www.crunchyroll.com/index/v2", Loc_CR_Cookies, Loc_AuthToken)
Dim cms_web() As String = cms.Split(New String() {Chr(34) + "cms_web" + Chr(34) + ":"}, System.StringSplitOptions.RemoveEmptyEntries)
Dim bucket1() As String = cms_web(1).Split(New String() {Chr(34) + "bucket" + Chr(34) + ":" + Chr(34)}, System.StringSplitOptions.RemoveEmptyEntries)
Dim bucket2() As String = bucket1(1).Split(New String() {Chr(34)}, System.StringSplitOptions.RemoveEmptyEntries)
Dim bucket As String = bucket2(0)
Dim policy1() As String = cms_web(1).Split(New String() {Chr(34) + "policy" + Chr(34) + ":" + Chr(34)}, System.StringSplitOptions.RemoveEmptyEntries)
Dim policy2() As String = policy1(1).Split(New String() {Chr(34)}, System.StringSplitOptions.RemoveEmptyEntries)
Dim policy As String = policy2(0)
Dim signature1() As String = cms_web(1).Split(New String() {Chr(34) + "signature" + Chr(34) + ":" + Chr(34)}, System.StringSplitOptions.RemoveEmptyEntries)
Dim signature2() As String = signature1(1).Split(New String() {Chr(34)}, System.StringSplitOptions.RemoveEmptyEntries)
Dim signature As String = signature2(0)
Dim key_pair_id1() As String = cms_web(1).Split(New String() {Chr(34) + "key_pair_id" + Chr(34) + ":" + Chr(34)}, System.StringSplitOptions.RemoveEmptyEntries)
Dim key_pair_id2() As String = key_pair_id1(1).Split(New String() {Chr(34)}, System.StringSplitOptions.RemoveEmptyEntries)
Dim key_pair_id As String = key_pair_id2(0)
'key_pair_id
'cms_web
Dim Videos1() As String = Streams.Split(New String() {"v2/cms"}, System.StringSplitOptions.RemoveEmptyEntries)
Dim Videos2() As String = Videos1(1).Split(New String() {"streams"}, System.StringSplitOptions.RemoveEmptyEntries)
Dim Videos As String = Videos2(0)
Dim VideoJson As String = Nothing Dim VideoJson As String = Nothing
Dim StreamUrl As String = "https://www.crunchyroll.com/cms/v2" + bucket + Videos + "streams?Policy=" + policy + "&Signature=" + signature + "&Key-Pair-Id=" + key_pair_id
VideoJson = CurlAuthNew(Streams, Loc_CR_Cookies, Loc_AuthToken) VideoJson = CurlAuthNew(StreamUrl, Loc_CR_Cookies, Loc_AuthToken) 'Curl(StreamUrl) '
'VideoJson = CurlAuthNew(Streams, Loc_CR_Cookies, Loc_AuthToken)
Debug.WriteLine("VideoJson: " + VideoJson) Debug.WriteLine("VideoJson: " + VideoJson)
Debug.WriteLine("VideoStreams: " + Streams) Debug.WriteLine("VideoStreams: " + Streams)
@ -1125,45 +1156,45 @@ Public Class Main
#Region "Check for dub override" #Region "Check for dub override"
If My.Settings.OverrideDub = True And CBool(InStr(Streams, "/videos/")) Then 'einstellung ein + kein musikvideo oder Konzert 'If My.Settings.OverrideDub = True And CBool(InStr(Streams, "/videos/")) Then 'einstellung ein + kein musikvideo oder Konzert
Dim Meta() As String = VideoJson.Split(New String() {Chr(34) + "meta" + Chr(34) + ":"}, System.StringSplitOptions.RemoveEmptyEntries) ' Dim Meta() As String = VideoJson.Split(New String() {Chr(34) + "meta" + Chr(34) + ":"}, System.StringSplitOptions.RemoveEmptyEntries)
Dim Meta2() As String = Meta(1).Split(New String() {Chr(34) + "audio_locale" + Chr(34) + ":" + Chr(34)}, System.StringSplitOptions.RemoveEmptyEntries) ' Dim Meta2() As String = Meta(1).Split(New String() {Chr(34) + "audio_locale" + Chr(34) + ":" + Chr(34)}, System.StringSplitOptions.RemoveEmptyEntries)
'MsgBox(DubSprache.CR_Value) ' 'MsgBox(DubSprache.CR_Value)
For i As Integer = 0 To Meta2.Count - 1 ' For i As Integer = 0 To Meta2.Count - 1
If CBool(InStr(Meta2(i), Chr(34) + "media_guid" + Chr(34) + ":" + Chr(34))) And CBool(InStr(Meta2(i), DubSprache.CR_Value)) Then ' If CBool(InStr(Meta2(i), Chr(34) + "media_guid" + Chr(34) + ":" + Chr(34))) And CBool(InStr(Meta2(i), DubSprache.CR_Value)) Then
Dim media_guid() As String = Meta2(i).Split(New String() {Chr(34) + "media_guid" + Chr(34) + ":" + Chr(34)}, System.StringSplitOptions.RemoveEmptyEntries) ' Dim media_guid() As String = Meta2(i).Split(New String() {Chr(34) + "media_guid" + Chr(34) + ":" + Chr(34)}, System.StringSplitOptions.RemoveEmptyEntries)
Dim media_guid2() As String = media_guid(1).Split(New String() {Chr(34)}, System.StringSplitOptions.RemoveEmptyEntries) ' Dim media_guid2() As String = media_guid(1).Split(New String() {Chr(34)}, System.StringSplitOptions.RemoveEmptyEntries)
If CBool(InStr(Streams, media_guid2(0))) Then ' If CBool(InStr(Streams, media_guid2(0))) Then
'MsgBox("done") ' 'MsgBox("done")
'done ' 'done
Exit For ' Exit For
Else ' Else
' overriding ' https://www.crunchyroll.com/content/v2/cms/videos/GPPFKG08N/streams?locale=de-DE ' ' overriding ' https://www.crunchyroll.com/content/v2/cms/videos/GPPFKG08N/streams?locale=de-DE
Streams = "https://www.crunchyroll.com/content/v2/cms/videos/" + media_guid2(0) + "/streams?locale=" + locale ' Streams = "https://www.crunchyroll.com/content/v2/cms/videos/" + media_guid2(0) + "/streams?locale=" + locale
'MsgBox(Streams) ' 'MsgBox(Streams)
VideoJson = CurlAuthNew(Streams, Loc_CR_Cookies, Loc_AuthToken) ' VideoJson = CurlAuthNew(Streams, Loc_CR_Cookies, Loc_AuthToken)
End If ' End If
End If ' End If
Next ' Next
End If 'End If
#End Region #End Region
@ -1180,66 +1211,75 @@ Public Class Main
For Each item As JProperty In VideoData For Each item As JProperty In VideoData
item.CreateReader() item.CreateReader()
Select Case item.Name Select Case item.Name
Case "data" 'each record is inside the entries array Case "streams" 'each record is inside the entries array
For Each Entry As JObject In item.Values For Each Entry As JProperty In item.Values
Dim VideoSubData As List(Of JToken) = Entry.Children().ToList Dim JsonEntryFormat As String = Entry.Name
For Each VideoSubItem As JProperty In VideoSubData If CBool(InStr(Entry.Name, "drm")) Or CBool(InStr(Entry.Name, "dash")) Or CBool(InStr(Entry.Name, "download")) Then
Continue For
Dim JsonEntryFormat As String = VideoSubItem.Name
If CBool(InStr(JsonEntryFormat, "drm")) Or CBool(InStr(JsonEntryFormat, "dash")) Or CBool(InStr(JsonEntryFormat, "urls")) Then ' Or CBool(InStr(JsonEntryFormat, "download")) workaround http 502 / false http 400
Continue For
End If
Dim SubData As List(Of JToken) = VideoSubItem.Children().ToList
For Each SubItem As JObject In SubData
SubItem.CreateReader()
Dim StreamFormats As List(Of JToken) = SubItem.Children().ToList
For Each HardsubStreams As JProperty In StreamFormats
HardsubStreams.CreateReader()
Dim SubLang As String = HardsubStreams.Name
Dim Url As String = HardsubStreams.Value("url").ToString
If SubLang = Nothing Or SubLang = "" Then
SubLang = ""
End If
If CBool(InStr(JsonEntryFormat, "download")) Then
download_hls = New CR_Beta_Stream(SubLang, JsonEntryFormat, Url)
Continue For
End If
CR_Streams.Add(New CR_Beta_Stream(SubLang, JsonEntryFormat, Url))
Next
Next
Next
If download_hls IsNot Nothing Then
CR_Streams.Add(download_hls)
End If End If
Next
Case "meta" 'each record is inside the entries array
For Each MetaEntrys As JProperty In item.Values
Select Case MetaEntrys.Name
Case "audio_locale" Dim SubData As List(Of JToken) = Entry.Children().ToList
If CR_audio_isDubbed = True Then For Each SubItem As JObject In SubData
Dim AudioTag As String = MetaEntrys.Value.ToString SubItem.CreateReader()
CR_audio_locale = String.Join(" ", AudioTag.Split(invalids, StringSplitOptions.RemoveEmptyEntries)).TrimEnd("."c).Replace(Chr(34), "").Replace("\", "").Replace("/", "").Replace(":", "")
Else Dim StreamFormats As List(Of JToken) = SubItem.Children().ToList
CR_audio_locale = "ja-JP"
For Each Formats As JProperty In StreamFormats
Formats.CreateReader()
Dim SubLang As String = Formats.Name
If SubLang = Nothing Or SubLang = "" Then
SubLang = "null"
End If End If
End Select Dim Url As String = CStr(Formats.Value("url"))
If CBool(InStr(JsonEntryFormat, "download")) Then
download_hls = New CR_Beta_Stream(SubLang, JsonEntryFormat, Url)
Continue For
End If
CR_Streams.Add(New CR_Beta_Stream(SubLang, JsonEntryFormat, Url))
Next
Next
Next Next
'Case "meta" 'each record is inside the entries array
' For Each MetaEntrys As JProperty In item.Values
' Select Case MetaEntrys.Name
' Case "audio_locale"
' If CR_audio_isDubbed = True Then
' Dim AudioTag As String = MetaEntrys.Value.ToString
' CR_audio_locale = String.Join(" ", AudioTag.Split(invalids, StringSplitOptions.RemoveEmptyEntries)).TrimEnd("."c).Replace(Chr(34), "").Replace("\", "").Replace("/", "").Replace(":", "")
' Else
' CR_audio_locale = "ja-JP"
' End If
' End Select
' Next
Case "audio_locale" 'each record is inside the entries array
'MsgBox(item.Value)
If CR_audio_isDubbed = True Then
Dim AudioTag As String = CStr(item.Value)
CR_audio_locale = String.Join(" ", AudioTag.Split(invalids, StringSplitOptions.RemoveEmptyEntries)).TrimEnd("."c).Replace(Chr(34), "").Replace("\", "").Replace("/", "").Replace(":", "")
Else
CR_audio_locale = "ja-JP"
End If
End Select End Select
Next Next
'MsgBox(CR_Streams.Count.ToString)
MsgBox(CR_HardSubLang)
Dim CR_URI_Master As New List(Of String) Dim CR_URI_Master As New List(Of String)
@ -1447,7 +1487,7 @@ Public Class Main
#Region "Chapters" #Region "Chapters"
Dim Mdata_File As String = Application.StartupPath + "\" + CR_EpisodeID + "-mdata.txt" Dim Mdata_File As String = Application.StartupPath + "\" + CR_EpisodeID + "-mdata.txt"
Debug.WriteLine("Checking chapters")
If CR_EpisodeID = "" Then If CR_EpisodeID = "" Then
'ignore for music video 'ignore for music video
Else Else
@ -1535,6 +1575,7 @@ Public Class Main
End If End If
End If End If
End If End If
Debug.WriteLine("Checking chapters ended")
#End Region #End Region
@ -4301,7 +4342,7 @@ Public Class Main
Sub FillArray() ' Sub FillArray() '
LangValueEnum.Add(New NameValuePair("[ null ]", "", "", Nothing)) LangValueEnum.Add(New NameValuePair("[ null ]", "", "null", Nothing))
LangValueEnum.Add(New NameValuePair("Deutsch", "ger", "de-DE", Nothing)) ' LangValueEnum.Add(New NameValuePair("Deutsch", "ger", "de-DE", Nothing)) '
@ -4878,6 +4919,8 @@ Public Class Main
End Function)) End Function))
End Sub End Sub
#End Region #End Region
End Class End Class

View File

@ -126,9 +126,6 @@
<metadata name="MenuStrip1.TrayLocation" type="System.Drawing.Point, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a"> <metadata name="MenuStrip1.TrayLocation" type="System.Drawing.Point, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a">
<value>118, 20</value> <value>118, 20</value>
</metadata> </metadata>
<metadata name="MenuStrip1.TrayLocation" type="System.Drawing.Point, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a">
<value>118, 20</value>
</metadata>
<metadata name="BackgroundWorker1.TrayLocation" type="System.Drawing.Point, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a"> <metadata name="BackgroundWorker1.TrayLocation" type="System.Drawing.Point, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a">
<value>332, 20</value> <value>332, 20</value>
</metadata> </metadata>

View File

@ -939,6 +939,9 @@ Public Class Einstellungen
GroupBox18.ForeColor = color GroupBox18.ForeColor = color
GroupBox19.ForeColor = color GroupBox19.ForeColor = color
GroupBox20.ForeColor = color GroupBox20.ForeColor = color
GroupBox21.ForeColor = color
GroupBox22.ForeColor = color
GroupBox23.ForeColor = color
End Sub End Sub
@ -1255,6 +1258,7 @@ Public Class Einstellungen
'Private Sub CB_CR_Audio_Click(sender As Object, e As EventArgs) Handles CB_CR_Audio.Click 'Private Sub CB_CR_Audio_Click(sender As Object, e As EventArgs) Handles CB_CR_Audio.Click
' Dim Popup As New CheckBoxComboBox ' Dim Popup As New CheckBoxComboBox
' Popup.Text = "CR Dub selection" ' Popup.Text = "CR Dub selection"