2023.9.21.0

PornHub: videos are not downloading
This commit is contained in:
Andy
2023-09-21 06:22:17 +03:00
parent a446df1f66
commit 77443cedc4
4 changed files with 39 additions and 3 deletions

View File

@@ -1,3 +1,10 @@
# 2023.9.21.0
*2023-09-21*
- Fixed
- PornHub: videos are not downloading
# 2023.9.20.0
*2023-09-20*

View File

@@ -14,6 +14,7 @@ Namespace API.PornHub
Private ReadOnly UnicodeHexConverter As Func(Of String, String) = Function(Input) SymbolsConverter.UnicodeHex.Decode(Input, EDP.ReturnValue)
#End Region
#Region "Declarations video"
Friend ReadOnly RegexVideo_MediaDef As RParams = RParams.DMS("mediaDefinitions.:\s*(\[\{.+?\}\])", 1, RegexOptions.Singleline, EDP.ReturnValue)
Friend ReadOnly RegexVideo_FlashVarsBlocks As RParams = RParams.DM("(?<=(flashvars_\['[nN]ext[vV]ideo'\]|flashvars_\d+[^ ]+? = media_\d+?);[\r\n]*?)(.+?)(?=;flashvars_\d+?)",
0, RegexReturn.List, EDP.ReturnValue)
Friend ReadOnly RegexVideo_FlashVars_Vars As RParams = RParams.DM("var ([\w\d]{10,})=("".+?)(?=(;|\Z))", 0, RegexReturn.List)

View File

@@ -818,6 +818,15 @@ Namespace API.PornHub
#End Region
#Region "CreateVideoURL"
Private Function CreateVideoURL(ByVal r As String) As String
If r.IsEmptyString Then
Return String.Empty
Else
Dim u$ = CreateVideoURL_FlashVars(r)
If u.IsEmptyString Then u = CreateVideoURL_MediaDef(r)
Return u
End If
End Function
Private Function CreateVideoURL_FlashVars(ByVal r As String) As String
Try
Dim OutStr$ = String.Empty
Dim OutList As New List(Of String)
@@ -876,7 +885,26 @@ Namespace API.PornHub
MyMainLOG = $"{ToStringForLog()}: something is wrong when parsing flashvars.{vbCr}{regex_ex.Message}"
Return String.Empty
Catch ex As Exception
Return ErrorsDescriber.Execute(EDP.SendToLog, ex, "[API.PornHub.UserData.CreateVideoURL]", String.Empty)
Return ErrorsDescriber.Execute(EDP.SendToLog, ex, "[API.PornHub.UserData.CreateVideoURL_FlashVars]", String.Empty)
End Try
End Function
Private Function CreateVideoURL_MediaDef(ByVal r As String) As String
Try
Dim result$ = String.Empty
If Not r.IsEmptyString Then
Dim script$ = RegexReplace(r, RegexVideo_MediaDef)
If Not script.IsEmptyString Then
Using j As EContainer = JsonDocument.Parse(script)
If j.ListExists Then
Dim s As List(Of Sizes) = j.Select(Function(jj) New Sizes(jj.Value("quality"), jj.Value("videoUrl"))).ToList
If s.ListExists Then s.Sort() : result = s(0).Data
End If
End Using
End If
End If
Return result
Catch ex As Exception
Return ErrorsDescriber.Execute(EDP.SendToLog, ex, "[API.PornHub.UserData.CreateVideoURL_MediaDef]", String.Empty)
End Try
End Function
#End Region

View File

@@ -32,6 +32,6 @@ Imports System.Runtime.InteropServices
' by using the '*' as shown below:
' <Assembly: AssemblyVersion("1.0.*")>
<Assembly: AssemblyVersion("2023.9.20.0")>
<Assembly: AssemblyFileVersion("2023.9.20.0")>
<Assembly: AssemblyVersion("2023.9.21.0")>
<Assembly: AssemblyFileVersion("2023.9.21.0")>
<Assembly: NeutralResourcesLanguage("en")>