Skip to content

Commit 7d9255c

Browse files
committed
2024.4.26.0
Add 'CookieValueExtractorAttribute' and the ability to immediately populate fields with values that can be extracted from cookies Feed: add the ability to load the last session of the current day (if it exists) as the current session after restarting SCrawler UserSearchForm: include friendly name matches in search result API.Xhamster: saved posts aren't downloading
1 parent 5b5857e commit 7d9255c

21 files changed

Lines changed: 412 additions & 157 deletions

Changelog.md

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,16 @@
1+
# 2024.4.26.0
2+
3+
*2024-04-26*
4+
5+
- Added
6+
- Site settings: the values that can be extracted from cookies immediately populate fields
7+
- Feed: ability to load the last session of the current day (if it exists) as the current session after restarting SCrawler
8+
- Users search: include friendly name matches in search result
9+
- Updated
10+
- gallery-dl up to version **1.26.9**
11+
- Fixed
12+
- xHamster: **saved posts aren't downloading**
13+
114
# 2024.4.14.0
215

316
*2024-04-14*
1.94 KB
Loading

SCrawler/API/Base/Declarations.vb

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@
66
'
77
' This program is distributed in the hope that it will be useful,
88
' but WITHOUT ANY WARRANTY
9+
Imports System.Runtime.CompilerServices
910
Imports PersonalUtilities.Forms
1011
Imports PersonalUtilities.Functions.RegularExpressions
1112
Namespace API.Base
@@ -72,5 +73,12 @@ Namespace API.Base
7273
$"Current query: [{CurrentQuery}]{vbCr}New query: [{NewQuery}]",
7374
"Changing a query"}, vbExclamation,,, {"Process", "Cancel"}) = 0
7475
End Function
76+
<Extension> Friend Function GetCookieValue(ByVal Cookies As IEnumerable(Of System.Net.Cookie), ByVal CookieName As String) As String
77+
If Cookies.ListExists Then Return If(Cookies.FirstOrDefault(Function(c) c.Name.ToLower = CookieName.ToLower)?.Value, String.Empty) Else Return String.Empty
78+
End Function
79+
<Extension> Friend Function GetCookieValue(ByVal Cookies As IEnumerable(Of System.Net.Cookie), ByVal CookieName As String,
80+
ByVal PropName As String, ByVal PropNameComp As String) As String
81+
Return If(PropName = PropNameComp, Cookies.GetCookieValue(CookieName), String.Empty)
82+
End Function
7583
End Module
7684
End Namespace

SCrawler/API/Instagram/SiteSettings.vb

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -65,6 +65,10 @@ Namespace API.Instagram
6565
Friend Const Header_Platform_Verion As String = "Sec-Ch-Ua-Platform-Version"
6666
<PropertyOption(ControlText:="x-csrftoken", ControlToolTip:="Can be automatically extracted from cookies", IsAuth:=True, AllowNull:=True), ControlNumber(2), PClonable(Clone:=False)>
6767
Friend ReadOnly Property HH_CSRF_TOKEN As PropertyValue
68+
<CookieValueExtractor(NameOf(HH_CSRF_TOKEN))>
69+
Private Function GetValueFromCookies(ByVal PropName As String, ByVal c As CookieKeeper) As String
70+
Return c.GetCookieValue(Header_CSRF_TOKEN_COOKIE, PropName, NameOf(HH_CSRF_TOKEN))
71+
End Function
6872
<PropertyOption(ControlText:="x-ig-app-id", IsAuth:=True, AllowNull:=False), ControlNumber(3), PClonable(Clone:=False)>
6973
Friend ReadOnly Property HH_IG_APP_ID As PropertyValue
7074
<PropertyOption(ControlText:="x-asbd-id", IsAuth:=True, AllowNull:=True), ControlNumber(4), PClonable(Clone:=False)>
@@ -557,7 +561,7 @@ Namespace API.Instagram
557561
If vals.Any(Function(v) Not v.ValueOld = v.ValueNew) OrElse
558562
Not Responser.Cookies.ListEquals(____Cookies) Then HH_IG_WWW_CLAIM.Value = 0 : credentialsUpdated = True
559563
If Responser.CookiesExists Then
560-
Dim csrf$ = If(Responser.Cookies.FirstOrDefault(Function(c) c.Name.StringToLower = Header_CSRF_TOKEN_COOKIE)?.Value, String.Empty)
564+
Dim csrf$ = GetValueFromCookies(NameOf(HH_CSRF_TOKEN), Responser.Cookies)
561565
If Not csrf.IsEmptyString Then
562566
If Not AEquals(Of String)(CStr(HH_CSRF_TOKEN.Value), csrf) Then credentialsUpdated = True
563567
HH_CSRF_TOKEN.Value = csrf

SCrawler/API/JustForFans/SiteSettings.vb

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,10 @@ Namespace API.JustForFans
2020
Friend ReadOnly Property UserID As PropertyValue
2121
<PropertyOption, PXML, PClonable(Clone:=False)>
2222
Friend ReadOnly Property UserHash4 As PropertyValue
23+
<CookieValueExtractor(NameOf(UserHash4))>
24+
Private Function GetValueFromCookies(ByVal PropName As String, ByVal c As CookieKeeper) As String
25+
Return c.GetCookieValue(UserHash4_CookieName, PropName, NameOf(UserHash4))
26+
End Function
2327
<PropertyOption(ControlText:="Accept", ControlToolTip:="Header 'Accept'"), PClonable>
2428
Friend ReadOnly Property HeaderAccept As PropertyValue
2529
<PropertyOption(InheritanceName:=SettingsCLS.HEADER_DEF_UserAgent), PClonable, PXML(OnlyForChecked:=True)>
@@ -61,7 +65,7 @@ Namespace API.JustForFans
6165
Private Sub UpdateUserHash4()
6266
If Responser.CookiesExists Then
6367
Dim hv_current$ = UserHash4.Value
64-
Dim hv_cookie$ = If(Responser.Cookies.FirstOrDefault(Function(cc) cc.Name.ToLower = UserHash4_CookieName)?.Value, String.Empty)
68+
Dim hv_cookie$ = GetValueFromCookies(NameOf(UserHash4), Responser.Cookies)
6569
If Not hv_cookie.IsEmptyString And Not hv_cookie = hv_current And Responser.Cookies.Changed Then UserHash4.Value = hv_cookie
6670
End If
6771
End Sub

SCrawler/API/OnlyFans/SiteSettings.vb

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -59,6 +59,16 @@ Namespace API.OnlyFans
5959
Responser.UserAgent = Value
6060
End If
6161
End Sub
62+
<CookieValueExtractor(NameOf(HH_USER_ID)), CookieValueExtractor(NameOf(HH_X_BC))>
63+
Private Function GetValueFromCookies(ByVal PropName As String, ByVal c As CookieKeeper) As String
64+
If c.ListExists Then
65+
Select Case PropName
66+
Case NameOf(HH_USER_ID) : Return c.GetCookieValue("auth_id")
67+
Case NameOf(HH_X_BC) : Return c.GetCookieValue("fp")
68+
End Select
69+
End If
70+
Return String.Empty
71+
End Function
6272
#End Region
6373
#Region "Rules"
6474
<PXML("LastDateUpdated")> Private ReadOnly Property LastDateUpdated_XML As PropertyValue

SCrawler/API/Pinterest/UserData.vb

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -287,7 +287,7 @@ Namespace API.Pinterest
287287
End Function
288288
End Class
289289
Private Function GetDataFromGalleryDL(ByVal URL As String, ByVal IsBoardsRequested As Boolean, ByVal Token As CancellationToken) As List(Of String)
290-
Dim command$ = $"gallery-dl --verbose --simulate "
290+
Dim command$ = $"""{Settings.GalleryDLFile.File}"" --verbose --simulate "
291291
Try
292292
If Not URL.IsEmptyString Then
293293
If MySettings.CookiesNetscapeFile.Exists Then command &= $"--cookies ""{MySettings.CookiesNetscapeFile}"" "

SCrawler/API/ThreadsNet/SiteSettings.vb

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -25,6 +25,10 @@ Namespace API.ThreadsNet
2525
Return __HH_CSRF_TOKEN
2626
End Get
2727
End Property
28+
<CookieValueExtractor(NameOf(HH_CSRF_TOKEN))>
29+
Private Function GetValueFromCookies(ByVal PropName As String, ByVal c As CookieKeeper) As String
30+
Return c.GetCookieValue(IG.Header_CSRF_TOKEN_COOKIE, PropName, NameOf(HH_CSRF_TOKEN))
31+
End Function
2832
<PClonable> Protected ReadOnly __HH_IG_APP_ID As PropertyValue
2933
<PropertyOption(ControlText:="x-ig-app-id", AllowNull:=False, IsAuth:=True), ControlNumber(10)>
3034
Friend Overridable ReadOnly Property HH_IG_APP_ID As PropertyValue
@@ -195,7 +199,7 @@ Namespace API.ThreadsNet
195199
End Sub
196200
Friend Overrides Sub Update()
197201
If _SiteEditorFormOpened And Responser.CookiesExists Then
198-
Dim csrf$ = If(Responser.Cookies.FirstOrDefault(Function(c) c.Name.StringToLower = IG.Header_CSRF_TOKEN_COOKIE)?.Value, String.Empty)
202+
Dim csrf$ = GetValueFromCookies(NameOf(HH_CSRF_TOKEN), Responser.Cookies)
199203
If Not csrf.IsEmptyString Then HH_CSRF_TOKEN.Value = csrf
200204
If Not __Cookies Is Nothing AndAlso Not __Cookies.ListEquals(Responser.Cookies) Then DownloadData_Impl.Value = True
201205
End If

SCrawler/API/Xhamster/UserData.vb

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -265,7 +265,12 @@ Namespace API.Xhamster
265265
Dim checkLimit As Func(Of Boolean) = Function() limit > 0 And SearchPostsCount >= limit And IsVideo
266266

267267
If IsSavedPosts Then
268-
containerNodes.Add(If(IsVideo, {"favoriteVideoListComponent", "models"}, {"favoritesGalleriesAndPhotosCollection"}))
268+
If IsVideo Then
269+
containerNodes.Add({"favoriteVideoListComponent", "models"})
270+
containerNodes.Add({"favoriteVideoListComponent", "videoThumbProps"})
271+
Else
272+
containerNodes.Add({"favoritesGalleriesAndPhotosCollection"})
273+
End If
269274
ElseIf Not SiteMode = SiteModes.Search Then
270275
If IsVideo Then
271276
containerNodes.Add({"trendingVideoListComponent", "models"})

SCrawler/Download/Feed/DownloadFeedForm.vb

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -173,6 +173,7 @@ Namespace DownloadObjects
173173
MENU_DOWN.Visible = OPT_SUBSCRIPTIONS.Checked
174174
UpdateSettings()
175175
FeedChangeMode(FeedModes.Current)
176+
Downloader.FilesLoadLastSession()
176177
RefillList(True, False)
177178
.EndLoaderOperations(False)
178179
End With

0 commit comments

Comments
 (0)