Skip to content

Commit 1404afd

Browse files
committed
2025.9.1.0
API.PornHub: update regex and data parsing
1 parent 5857fcf commit 1404afd

File tree

4 files changed

+32
-10
lines changed

4 files changed

+32
-10
lines changed

Changelog.md

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,10 @@
1+
# 2025.9.1.0
2+
3+
*2025-09-01*
4+
5+
- Fixed
6+
- PornHub: data is not downloading
7+
18
# 2025.8.30.0
29

310
*2025-08-30*

SCrawler/API/PornHub/Declarations.vb

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@ Namespace API.PornHub
2020
Friend ReadOnly RegexVideo_FlashVars_Vars As RParams = RParams.DM("var ([\w\d]{10,})=("".+?)(?=(;|\Z))", 0, RegexReturn.List)
2121
Friend ReadOnly RegexVideo_FlashVars_Compiler As RParams = RParams.DM("(?<=\*/)([\w\d\S]{10,})", 0, RegexReturn.List)
2222
Friend ReadOnly RegexVideo_FlashVars_UrlResolution As RParams = RParams.DMS("/(\d+)[^/]+\.mp4", 1, EDP.ReturnValue)
23-
Friend ReadOnly RegexUserVideos As RParams = RParams.DM("(\<li class=""pcVideoListItem)((?:(?!/li\>).)*?)(\<div.class=.private-vid-title((?:(?!/li\>).)*?)|)(\<a.href=.([^""]+?)"".title=.([^""]*?)"")(((?:(?!/li\>).)+?)(\<div class=.videoUploaderBlock)|)((?:(?!/li\>).)*?)(\</li\>)",
23+
Friend ReadOnly RegexUserVideos As RParams = RParams.DM("(\<li class=""pcVideoListItem)((?:(?!/li\>).)*?)(\<div.class=.private-vid-title((?:(?!/li\>).)*?)|)(\<a.href=.([^""]+?)"".title=.([^""]*?)"")(((?:(?!/li\>).)+?)(\<div class=.videoUploaderBlock.*?href=""([^""]+)"")|)((?:(?!/li\>).)*?)(\</li\>)",
2424
0, RegexOptions.Singleline, RegexReturn.List, EDP.ReturnValue, UnicodeHexConverter)
2525
Friend ReadOnly RegexVideo_Video_VideoKey As RParams = RParams.DMS("viewkey=([\w\d]+)", 1, EDP.ReturnValue)
2626
Friend ReadOnly RegexVideoPageTitle As RParams = RParams.DMS("meta (property|name)=""[^:]+?:title"" content=""([^""]+)""", 2, EDP.ReturnValue)

SCrawler/API/PornHub/UserData.vb

Lines changed: 22 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -50,6 +50,7 @@ Namespace API.PornHub
5050
Friend URL As String
5151
Friend ID As String
5252
Friend Title As String
53+
Friend UserRef As String
5354
Friend Type As VideoTypes
5455
Friend Function ToUserMedia(Optional ByVal SpecialFolder As String = Nothing) As UserMedia
5556
Return New UserMedia(URL, UTypes.VideoPre) With {
@@ -66,14 +67,16 @@ Namespace API.PornHub
6667
URL = String.Empty
6768
Else
6869
URL = String.Format(UrlPattern, URL.TrimStart("/"))
70+
6971
Title = TitleHtmlConverter(ParamsArray(1))
7072
If Not ParamsArray(2).IsEmptyString Then
7173
Type = VideoTypes.Private
72-
ElseIf Not ParamsArray(3).IsEmptyString Then
73-
Type = VideoTypes.Tagged
74+
'ElseIf Not ParamsArray(3).IsEmptyString Then
75+
' Type = VideoTypes.Tagged
7476
Else
7577
Type = VideoTypes.Uploaded
7678
End If
79+
If Not ParamsArray(3).IsEmptyString Then UserRef = ParamsArray(3).StringTrim
7780
End If
7881
End If
7982
Return Me
@@ -338,10 +341,13 @@ Namespace API.PornHub
338341
Dim tryNextPage As Boolean = False
339342
Dim limit% = If(DownloadTopCount, -1)
340343
Dim cBefore% = _TempMediaList.Count
344+
Dim usrRef$ = String.Empty
345+
Dim npd$ = "?"
341346
If IsUser Then
342347
URL = $"https://www.pornhub.com/{PersonType}/{NameTrue}"
348+
usrRef = $"/{PersonType}/{NameTrue}"
343349
If Type = VideoTypes.Uploaded Then
344-
URL &= "/videos/upload"
350+
If Not PersonType = PersonTypeCannel Then URL &= "/videos/upload?o=mr" : npd = "&"
345351
ElseIf Type = VideoTypes.Tagged Then
346352
If Not SecondMode Then URL &= "/videos"
347353
specFolder = "Tagged"
@@ -354,7 +360,7 @@ Namespace API.PornHub
354360
Else
355361
Throw New ArgumentException($"Type '{Type}' is not implemented in the video download function", "Type")
356362
End If
357-
If Page > 1 Then URL &= $"?page={Page}"
363+
If Page > 1 Then URL &= $"{npd}page={Page}"
358364
ElseIf SiteMode = SiteModes.Playlists Then
359365
If PlaylistToken.IsEmptyString Then Throw New ArgumentNullException("PlaylistToken", "Unable to get 'PlaylistToken'")
360366
URL = String.Format(PlayListUrlPattern, NameTrue, PlaylistToken, Page)
@@ -367,12 +373,21 @@ Namespace API.PornHub
367373
'Debug.WriteLine(URL)
368374
Dim r$ = Responser.GetResponse(URL)
369375
If Not r.IsEmptyString Then
370-
Dim l As List(Of UserVideo) = RegexFields(Of UserVideo)(r, {RegexUserVideos}, {6, 7, 3, 10})
376+
Dim l As List(Of UserVideo) = RegexFields(Of UserVideo)(r, {RegexUserVideos}, {6, 7, 3, 11})
371377
'If l.ListExists And Not SiteMode = SiteModes.Playlists Then l = l.ListTake(3, l.Count).ToList
372-
If l.ListExists And Not SiteMode = SiteModes.Playlists Then l = l.ListTake(1, l.Count).ToList
378+
If l.ListExists And Not SiteMode = SiteModes.Playlists And Not IsUser Then l = l.ListTake(1, l.Count).ToList
373379
If l.ListExists Then
374380
If IsUser Then
375-
If Type = VideoTypes.Favorite Then
381+
If Type = VideoTypes.Tagged Then
382+
l = l.ListTake(4, l.Count)
383+
If l.ListExists Then l.RemoveAll(Function(uv) Not uv.UserRef.IsEmptyString AndAlso uv.UserRef = usrRef)
384+
ElseIf Type = VideoTypes.Uploaded Then
385+
If PersonType = PersonTypeCannel Then
386+
l = l.ListTake(4, l.Count)
387+
Else
388+
l.RemoveAll(Function(uv) uv.UserRef.IsEmptyString OrElse Not uv.UserRef = usrRef)
389+
End If
390+
ElseIf Type = VideoTypes.Favorite Then
376391
l.RemoveAll(Function(uv) uv.Type = VideoTypes.Private)
377392
ElseIf Not PersonType = PersonTypeCannel Then
378393
l.RemoveAll(Function(uv) Not uv.Type = Type)

SCrawler/My Project/AssemblyInfo.vb

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -32,6 +32,6 @@ Imports System.Runtime.InteropServices
3232
' by using the '*' as shown below:
3333
' <Assembly: AssemblyVersion("1.0.*")>
3434

35-
<Assembly: AssemblyVersion("2025.8.30.0")>
36-
<Assembly: AssemblyFileVersion("2025.8.30.0")>
35+
<Assembly: AssemblyVersion("2025.9.1.0")>
36+
<Assembly: AssemblyFileVersion("2025.9.1.0")>
3737
<Assembly: NeutralResourcesLanguage("en")>

0 commit comments

Comments
 (0)