replace fixed user agent string with webview user agent strring

replace fixed user agent string with webview user agent strring
This commit is contained in:
hama3254 2023-04-21 17:03:00 +02:00
parent af6eadbb18
commit 412555184c
14 changed files with 45 additions and 36 deletions

Binary file not shown.

View File

@ -192,7 +192,7 @@ Public Class Anime_Add
Try
Using client As New WebClient()
client.Encoding = System.Text.Encoding.UTF8
client.Headers.Add(My.Resources.ffmpeg_user_agend.Replace(Chr(34), ""))
client.Headers.Add(My.Settings.User_Agend.Replace(Chr(34), ""))
v1Json = client.DownloadString(v1JsonUrl)
End Using
Main.WebbrowserURL = textBox1.Text
@ -489,7 +489,7 @@ Public Class Anime_Add
Try
Using client As New WebClient()
client.Encoding = System.Text.Encoding.UTF8
client.Headers.Add(My.Resources.ffmpeg_user_agend.Replace(Chr(34), ""))
client.Headers.Add(My.Settings.User_Agend.Replace(Chr(34), ""))
EpisodeJson = client.DownloadString(EpisodeJsonURL)
End Using
Catch ex As Exception

View File

@ -162,6 +162,9 @@
<setting name="Captions" serializeAs="String">
<value>False</value>
</setting>
<setting name="User_Agend" serializeAs="String">
<value>"User-Agent: Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/112.0.0.0 Safari/537.36 Edg/112.0.1722.34"</value>
</setting>
</Crunchyroll_Downloader.My.MySettings>
</userSettings>
</configuration>

View File

@ -26,7 +26,9 @@ Public Class Browser
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: ", "")
'WebView2.CoreWebView2.Settings.UserAgent = My.Settings.User_Agend.Replace(Chr(34), "").Replace("User-Agent: ", "")
My.Settings.User_Agend = Chr(34) + "User-Agent: " + WebView2.CoreWebView2.Settings.UserAgent + Chr(34)
'MsgBox(My.Settings.User_Agend)
If WebView2.CoreWebView2.Source = "about:blank" Or WebView2.CoreWebView2.Source = Nothing Then
'TextBox1.Text = Main.Startseite
WebView2.CoreWebView2.Navigate(Main.Startseite)

View File

@ -744,7 +744,7 @@ Public Class CRD_List_Item
Dim Request As HttpWebRequest = CType(WebRequest.Create(DL_URL), HttpWebRequest)
Dim Bytes(NewBytes) As Byte
Request.UserAgent = My.Resources.ffmpeg_user_agend.Replace(Chr(34), "").Replace("User-Agent: ", "")
Request.UserAgent = My.Settings.User_Agend.Replace(Chr(34), "").Replace("User-Agent: ", "")
Request.Timeout = 30000
Request.Method = "GET"
Request.AddRange(CurrentSize, CurrentSize + NewBytes)
@ -1203,8 +1203,8 @@ Public Class CRD_List_Item
RaiseEvent UpdateUI(100, di, PauseTime)
If CBool(InStr(DL_URL, " -headers " + My.Resources.ffmpeg_user_agend)) = True And CBool(InStr(DL_URL, "https:\\")) = False Then
DL_URL = DL_URL.Replace(" -headers " + My.Resources.ffmpeg_user_agend, "")
If CBool(InStr(DL_URL, " -headers " + My.Settings.User_Agend)) = True And CBool(InStr(DL_URL, "https:\\")) = False Then
DL_URL = DL_URL.Replace(" -headers " + My.Settings.User_Agend, "")
End If
'MsgBox(DL_URL)
@ -1252,7 +1252,7 @@ Public Class CRD_List_Item
Dim exepath As String = Application.StartupPath + "\ffmpeg.exe"
Dim startinfo As New System.Diagnostics.ProcessStartInfo
Dim cmd As String = "-user_agent " + My.Resources.ffmpeg_user_agend.Replace("User-Agent: ", "") + " -headers " + Chr(34) + "ACCEPT-ENCODING: *" + Chr(34) + " " + DLCommand + " " + DL_Pfad 'start ffmpeg with command strFFCMD string
Dim cmd As String = "-user_agent " + My.Settings.User_Agend.Replace("User-Agent: ", "") + " -headers " + Chr(34) + "ACCEPT-ENCODING: *" + Chr(34) + " " + DLCommand + " " + DL_Pfad 'start ffmpeg with command strFFCMD string
LogText.Add(Date.Now.ToString + " " + cmd)
If Debug2 = True Then
MsgBox(cmd)
@ -1464,7 +1464,7 @@ Public Class CRD_List_Item
'MsgBox(BaseURL + SiteList(i) + vbNewLine + Pfad_DL + "\" + SiteList(i))
Dim iWert As Integer = i
Using client As New WebClient()
client.Headers.Add(My.Resources.ffmpeg_user_agend.Replace(Chr(34), ""))
client.Headers.Add(My.Settings.User_Agend.Replace(Chr(34), ""))
client.Headers.Add(HttpRequestHeader.AcceptEncoding, "*")
client.DownloadFile(BaseURL + SiteList(i), Pfad_DL + "\" + SiteList(i))
Pause(1)

View File

@ -15,7 +15,7 @@ Module GetData
If Main.Curl_insecure = True Then
cmd = "--insecure "
End If
cmd = cmd + "--no-alpn -fsSLm 15 -A " + My.Resources.ffmpeg_user_agend.Replace("User-Agent: ", "") + " " + Chr(34) + Url + Chr(34)
cmd = cmd + "--no-alpn -fsSLm 15 -A " + My.Settings.User_Agend.Replace("User-Agent: ", "") + " " + Chr(34) + Url + Chr(34)
Dim Proc As New Process
'MsgBox(cmd)
Dim CurlOutput As String = Nothing
@ -84,7 +84,7 @@ Module GetData
If Main.Curl_insecure = True Then
cmd = "--insecure "
End If
cmd = cmd + "--no-alpn -fsSLm 15 -A " + My.Resources.ffmpeg_user_agend.Replace("User-Agent: ", "") + Cookies + Auth + Post + " " + Chr(34) + Url + Chr(34)
cmd = cmd + "--no-alpn -fsSLm 15 -A " + My.Settings.User_Agend.Replace("User-Agent: ", "") + Cookies + Auth + Post + " " + Chr(34) + Url + Chr(34)
Dim Proc As New Process
'Debug.WriteLine("CurlPost: " + cmd)
Dim CurlOutput As String = Nothing
@ -154,7 +154,7 @@ Module GetData
If Main.Curl_insecure = True Then
cmd = "--insecure "
End If
cmd = cmd + "--no-alpn -fsSLm 15 -A " + My.Resources.ffmpeg_user_agend.Replace("User-Agent: ", "") + Cookies + Auth + " " + Chr(34) + Url + Chr(34)
cmd = cmd + "--no-alpn -fsSLm 15 -A " + My.Settings.User_Agend.Replace("User-Agent: ", "") + Cookies + Auth + " " + Chr(34) + Url + Chr(34)
Dim Proc As New Process
'MsgBox(cmd)
Dim CurlOutput As String = Nothing

View File

@ -2249,7 +2249,7 @@ Public Class Main
Try
Using client As New WebClient()
client.Encoding = System.Text.Encoding.UTF8
client.Headers.Add(My.Resources.ffmpeg_user_agend.Replace(Chr(34), ""))
client.Headers.Add(My.Settings.User_Agend.Replace(Chr(34), ""))
SeasonJson = client.DownloadString(JsonUrl)
End Using
Catch ex As Exception
@ -2426,7 +2426,7 @@ Public Class Main
Try
Using client As New WebClient()
client.Encoding = System.Text.Encoding.UTF8
client.Headers.Add(My.Resources.ffmpeg_user_agend.Replace(Chr(34), ""))
client.Headers.Add(My.Settings.User_Agend.Replace(Chr(34), ""))
v1Json = client.DownloadString(v1JsonUrl)
End Using
WebbrowserURL = ListOfEpisodes(i)
@ -2542,7 +2542,7 @@ Public Class Main
'Throw New Exception("TEst")
Using client As New WebClient()
client.Encoding = System.Text.Encoding.UTF8
client.Headers.Add(My.Resources.ffmpeg_user_agend.Replace(Chr(34), ""))
client.Headers.Add(My.Settings.User_Agend.Replace(Chr(34), ""))
v1Json = client.DownloadString(v1JsonUrl)
End Using
Catch ex As Exception
@ -2773,7 +2773,7 @@ Public Class Main
Dim EpisodeJsonString As String = Nothing
Dim PlayerClient As New WebClient
PlayerClient.Encoding = Encoding.UTF8
PlayerClient.Headers.Add(My.Resources.ffmpeg_user_agend.Replace(Chr(34), ""))
PlayerClient.Headers.Add(My.Settings.User_Agend.Replace(Chr(34), ""))
PlayerClient.Headers.Add(HttpRequestHeader.Accept, "application/json, text/plain, */*")
PlayerClient.Headers.Add("origin: https://www.funimation.com/")
PlayerClient.Headers.Add(HttpRequestHeader.Referer, "https://www.funimation.com/")
@ -2964,7 +2964,7 @@ Public Class Main
Dim FunimationAudio() As String = str1.Split(New String() {"# AUDIO groups"}, System.StringSplitOptions.RemoveEmptyEntries)
Dim FunimationAudio2() As String = FunimationAudio(1).Split(New String() {"URI=" + Chr(34)}, System.StringSplitOptions.RemoveEmptyEntries)
Dim FunimationAudio3() As String = FunimationAudio2(1).Split(New String() {Chr(34)}, System.StringSplitOptions.RemoveEmptyEntries)
FunimationAudioMap = " -headers " + My.Resources.ffmpeg_user_agend + " -i " + Chr(34) + FunimationAudio3(0) + Chr(34)
FunimationAudioMap = " -headers " + My.Settings.User_Agend + " -i " + Chr(34) + FunimationAudio3(0) + Chr(34)
End If
Dim str2() As String = str1.Split(New String() {"# keyframes"}, System.StringSplitOptions.RemoveEmptyEntries)
@ -3157,9 +3157,9 @@ Public Class Main
DispositionIndex = MapCount
End If
If SoftSubMergeURLs = Nothing Then
SoftSubMergeURLs = " -headers " + My.Resources.ffmpeg_user_agend + " -i " + Chr(34) + SoftSub(0) + Chr(34)
SoftSubMergeURLs = " -headers " + My.Settings.User_Agend + " -i " + Chr(34) + SoftSub(0) + Chr(34)
Else
SoftSubMergeURLs = SoftSubMergeURLs + " -headers " + My.Resources.ffmpeg_user_agend + " -i " + Chr(34) + SoftSub(0) + Chr(34)
SoftSubMergeURLs = SoftSubMergeURLs + " -headers " + My.Settings.User_Agend + " -i " + Chr(34) + SoftSub(0) + Chr(34)
End If
If FunimationAudioMap = Nothing Then
SoftSubMergeMaps = SoftSubMergeMaps + " -map " + (MapCount + 1).ToString
@ -3231,7 +3231,7 @@ Public Class Main
If FunimationAudioMap = Nothing Then
Funimation_m3u8_final = "-i " + Chr(34) + Funimation_m3u8_final + Chr(34) + DubMetatata + " " + ffmpeg_command_temp
Else
Funimation_m3u8_final = FunimationAudioMap.Replace(" -headers " + My.Resources.ffmpeg_user_agend + " ", "") + DubMetatata + " " + ffmpeg_command_temp
Funimation_m3u8_final = FunimationAudioMap.Replace(" -headers " + My.Settings.User_Agend + " ", "") + DubMetatata + " " + ffmpeg_command_temp
End If
Else
Funimation_m3u8_final = "-i " + Chr(34) + Funimation_m3u8_final + Chr(34) + FunimationAudioMap + DubMetatata + " " + ffmpeg_command
@ -3335,7 +3335,7 @@ Public Class Main
Try
Using client As New WebClient()
client.Encoding = System.Text.Encoding.UTF8
client.Headers.Add(My.Resources.ffmpeg_user_agend.Replace(Chr(34), ""))
client.Headers.Add(My.Settings.User_Agend.Replace(Chr(34), ""))
Dim SaveName As String = System.Text.RegularExpressions.Regex.Replace(DocumentTitle.Replace(" - Schaue legal auf Wakanim.TV", ""), "[^\w\\-]", " ").Replace(":", "")
SaveName = RemoveExtraSpaces(SaveName)
client.DownloadFile(WakanimSub2(0), Pfad + "\" + SaveName + ".vtt")

View File

@ -32,6 +32,6 @@ Imports System.Runtime.InteropServices
' übernehmen, indem Sie "*" eingeben:
' <Assembly: AssemblyVersion("1.0.*")>
<Assembly: AssemblyVersion("3.15.1")>
<Assembly: AssemblyFileVersion("3.15.1")>
<Assembly: AssemblyVersion("3.15.2")>
<Assembly: AssemblyFileVersion("3.15.2")>
<Assembly: NeutralResourcesLanguage("en")>

View File

@ -398,15 +398,6 @@ Namespace My.Resources
End Get
End Property
'''<summary>
''' Sucht eine lokalisierte Zeichenfolge, die &quot;User-Agent: Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:107.0) Gecko/20100101 Firefox/107.0&quot; ähnelt.
'''</summary>
Friend ReadOnly Property ffmpeg_user_agend() As String
Get
Return ResourceManager.GetString("ffmpeg_user_agend", resourceCulture)
End Get
End Property
'''<summary>
''' Sucht eine lokalisierte Zeichenfolge, die src=&quot;/player/ ähnelt.
'''</summary>

View File

@ -391,9 +391,6 @@ Dialogue: 0,0:00:00.00,0:00:00.00,Default,,0000,0000,0000,,some ideas on how tem
<data name="crdSettings_Button_SafeExit_hover" type="System.Resources.ResXFileRef, System.Windows.Forms">
<value>..\Resources\crdSettings_Button_SafeExit_hover.png;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a</value>
</data>
<data name="ffmpeg_user_agend" xml:space="preserve">
<value>"User-Agent: Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:107.0) Gecko/20100101 Firefox/107.0"</value>
</data>
<data name="crdSettings_Button_SafeExit" type="System.Resources.ResXFileRef, System.Windows.Forms">
<value>..\Resources\crdSettings_Button_SafeExit.png;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a</value>
</data>

View File

@ -617,6 +617,19 @@ Namespace My
Me("Captions") = value
End Set
End Property
<Global.System.Configuration.UserScopedSettingAttribute(), _
Global.System.Diagnostics.DebuggerNonUserCodeAttribute(), _
Global.System.Configuration.DefaultSettingValueAttribute("""User-Agent: Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML,"& _
" like Gecko) Chrome/112.0.0.0 Safari/537.36 Edg/112.0.1722.34""")> _
Public Property User_Agend() As String
Get
Return CType(Me("User_Agend"),String)
End Get
Set
Me("User_Agend") = value
End Set
End Property
End Class
End Namespace

View File

@ -143,5 +143,8 @@
<Setting Name="Captions" Type="System.Boolean" Scope="User">
<Value Profile="(Default)">False</Value>
</Setting>
<Setting Name="User_Agend" Type="System.String" Scope="User">
<Value Profile="(Default)">"User-Agent: Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/112.0.0.0 Safari/537.36 Edg/112.0.1722.34"</Value>
</Setting>
</Settings>
</SettingsFile>

View File

@ -973,7 +973,7 @@ Public Class Einstellungen
Try
Dim client0 As New WebClient
client0.Encoding = Encoding.UTF8
client0.Headers.Add(My.Resources.ffmpeg_user_agend.Replace(Chr(34), ""))
client0.Headers.Add(My.Settings.User_Agend.Replace(Chr(34), ""))
Dim str0 As String = client0.DownloadString("https://api.github.com/repos/hama3254/Crunchyroll-Downloader-v3.0/releases")

View File

@ -96,7 +96,7 @@ Public Class Queue
Try
Using client As New WebClient()
client.Encoding = System.Text.Encoding.UTF8
client.Headers.Add(My.Resources.ffmpeg_user_agend.Replace(Chr(34), ""))
client.Headers.Add(My.Settings.User_Agend.Replace(Chr(34), ""))
v1Json = client.DownloadString(v1JsonUrl)
End Using
Main.Funimation_Grapp_RDY = False