mirror of
https://github.com/AAndyProgram/SCrawler.git
synced 2026-03-14 15:52:18 +00:00
Plugins.Attributes: add 'DependentFields' attribute Plugins.IPluginContentProvider: add 'Options' and 'IsSubscription' properties Plugins.ISiteSettings: add 'SubscriptionsAllowed' property Plugins.ExchangeOptions: add 'Options' field Plugins.Attributes.PropertyUpdater: replace 'Dependencies' with 'Arguments' YT: add 'OutputPathAskForName' and 'OutputPathAutoAddPaths' properties; add the ability to store download locations; add 'DownloadLocation' and 'DownloadLocationsCollection' objects YT.IDownloaderSettings: add 'OutputPathAskForName' and 'OutputPathAutoAddPaths' properties YT.Downloader: fixed bug with re-saving elements when loading a video list; fixed bug when files were not deleted when clicking on the delete button; fixed a bug that caused the video to redownload; download job removes elements at wrong indexes; added skipping of downloaded elements in the job; fixed a bug, pending option did not change after download complete YT.YouTubeMediaContainerBase: add '_MediaStateOnLoad' field and 'NeedToSave' function; update the 'Save' function to prevent saving a file when a download is complete and the file has already been saved; update code for new yt-dlp version Fixed cache deletion errors Add user queue Add global locations API.Base.SiteSettingsBase: implement 'SubscriptionsAllowed' property; remove request headers with null values on save; add '_AllowUserAgentUpdate' parameter API.Base.Structures: add 'SiteModes' enum API.Base.UserDataBase: add 'Erase' button; implement 'Options' and 'IsSubscription' properties; add 'SpecialLabels' property; update 'LVIKey'; update 'FitToAddParams' function; add 'EraseData' function; user colors; Not UserExists notification, UserQueue support API.Base: add 'DeclaredNames' API.Instagram: remove default values for headers; disable updating UserAgent from global; check for a new username for non-existent users API.Mastodon: bypass new inherited twitter options; update names and headers API.OnlyFans: make 'HH_BROWSER' property nullable; remove 'HH_BROWSER' from required; fix username bug (dots); handling of 504 and 429 errors; add 'DownloadHighlights' and 'DownloadChatMedia' options; add 'UserExchangeOptions'; fixed incorrect error handler API.PathPlugin: fixed incorrect detection of path existence API.Pinterest: add 'SpecialLabels' API.PornHub: add new video regex; remove old regex; added 'DownloadUploaded', 'DownloadTagged', 'DownloadPrivate' and 'DownloadFavorite' properties to 'SiteSettings', 'UserData' and 'UserExchangeOptions'; update regex to define user; added downloading search queries; update 'GetUserUrl' function; hide unnecessary 'RegexFieldsTextBecameNullException' errors; add subscriptions API.Reddit: add 'SpecialLabels'; add bearer token and its refresh interval; add OAuth; add additional options API.RedGifs: add 'DependentFields' for 'Token' API.ThisVid: add 'DownloadFavourite' option; add downloading search queries, tags, categories; add 'SpecialLabels'; add subscriptions; updating cookies issue API.TikTok: rewrite algorithms API.Twitter: add 'UseAppropriateModel', 'UseNewEndPointSearch', 'UseNewEndPointProfiles', 'AbortOnLimit', 'DownloadAlreadyParsed', 'MediaModelAllowNonUserTweets' properties; remove old commented code; remove 'TwitterPic_400' and replace with 'TwitterIcon_32.ToBitmap'; add 'DownloadModelForceApply' user option; update environment to GDL 1.25.8; fixed gifs downloading; fix typo in 'ReparseMissing'; update names API.UserDataBind: prevent adding site-specific labels when adding to a collection API.Xhamster: add downloading search queries, tags, categories; add 'SpecialLabels'; add additional nodes for channels; add subscriptions API.XVIDEOS: add downloading search queries, tags, categories; add 'SpecialLabels'; add subscriptions; changed users creation method; add subscriptions API.YouTube: add subscriptions AutoDownloader: add new group subscription options; update predicates; fixed excluded labels and sites in default mode; update notifications; add an additional skip options, add 'Force start' option DownloadedInfoForm: add subscriptions; fixed size/location bug; hide unnecessary error (refill) Feed: add subscriptions; update filters; add 'Ctrl+G' shortcut FeedMedia: add subscriptions; fixed 'webm' bug; add title for subscription media; add site icon to post; user colors; always using 'FriendlyName' instead of 'UserName' if it exists DownloadGroup, GroupDefaults, GroupParameters: add subscription and 'UsersCount' options MissingPostsForm: add 'BTT_DELETE_ALL' VideoDownloaderForm, DownloaderUrlForm, DownloaderUrlsArrForm: add download locations support VideoDownloaderForm: add subscriptions support GlobalSettingsForm: add new properties UserCreatorForm: add subscriptions; add 'Options' support (of 'ExchangeOptions'); user colors ListImagesLoader: add subscription colors; user colors MainFrame: add subscriptions; add filters by subscription and user; update predicates NuGet: update 'LibVLCSharp', 'LibVLCSharp.WinForms', 'VideoLAN.LibVLC.Windows' DownloadableMediaHost: update 'Save' function PropertyValueHost: fix 'CaptionWidth' bug; add 'Dependents' SettingsHost: add 'Dependents' UserDataHost: add 'Options' and 'IsSubscription' properties SettingsCLS: implement new 'IDownloaderSettings' properties; add 'CacheSnapshots'; add 'DownloadLocations'; add new properties UserInfo, UserFinder: add subscriptions UserSearchForm: fixed search by name bug
186 lines
9.2 KiB
VB.net
186 lines
9.2 KiB
VB.net
' Copyright (C) 2023 Andy https://github.com/AAndyProgram
|
|
' This program is free software: you can redistribute it and/or modify
|
|
' it under the terms of the GNU General Public License as published by
|
|
' the Free Software Foundation, either version 3 of the License, or
|
|
' (at your option) any later version.
|
|
'
|
|
' This program is distributed in the hope that it will be useful,
|
|
' but WITHOUT ANY WARRANTY
|
|
Imports SCrawler.API
|
|
Imports SCrawler.API.Base
|
|
Imports SCrawler.Plugin.Hosts
|
|
Imports PersonalUtilities.Functions.XML
|
|
Imports PersonalUtilities.Functions.XML.Base
|
|
Partial Friend Module MainMod
|
|
Friend Structure UserInfo : Implements IComparable(Of UserInfo), IEquatable(Of UserInfo), IEContainerProvider
|
|
#Region "XML Names"
|
|
Friend Const Name_UserNode As String = "User"
|
|
Friend Const Name_Site As String = "Site"
|
|
Friend Const Name_Plugin As String = "Plugin"
|
|
Friend Const Name_IsSubscription As String = "IsSubscription"
|
|
Friend Const Name_Collection As String = "Collection"
|
|
Friend Const Name_Model_User As String = "ModelUser"
|
|
Friend Const Name_Model_Collection As String = "ModelCollection"
|
|
Friend Const Name_Merged As String = "Merged"
|
|
Friend Const Name_SpecialPath As String = "SpecialPath"
|
|
Friend Const Name_SpecialCollectionPath As String = "SpecialCollectionPath"
|
|
Private Const Name_LastSeen As String = "LastSeen"
|
|
#End Region
|
|
#Region "Declarations"
|
|
Friend Name As String
|
|
Friend Site As String
|
|
Friend Plugin As String
|
|
Friend File As SFile
|
|
Friend IsSubscription As Boolean
|
|
Friend SpecialPath As SFile
|
|
Friend SpecialCollectionPath As SFile
|
|
Friend Merged As Boolean
|
|
Friend ReadOnly Property IncludedInCollection As Boolean
|
|
Get
|
|
Return Not CollectionName.IsEmptyString
|
|
End Get
|
|
End Property
|
|
Friend ReadOnly Property IsVirtual As Boolean
|
|
Get
|
|
Return CollectionModel = UsageModel.Virtual Or UserModel = UsageModel.Virtual
|
|
End Get
|
|
End Property
|
|
Friend UserModel As UsageModel
|
|
Friend CollectionName As String
|
|
Friend CollectionModel As UsageModel
|
|
Friend [Protected] As Boolean
|
|
Friend ReadOnly Property IsProtected As Boolean
|
|
Get
|
|
Return [Protected] Or (LastSeen.HasValue AndAlso LastSeen.Value.AddDays(30) < Now)
|
|
End Get
|
|
End Property
|
|
Friend LastSeen As Date?
|
|
#End Region
|
|
#Region "Initializers"
|
|
Friend Sub New(ByVal _Name As String, ByVal Host As SettingsHost)
|
|
Name = _Name
|
|
Site = Host.Name
|
|
Plugin = Host.Key
|
|
UpdateUserFile()
|
|
End Sub
|
|
Private Sub New(ByVal x As EContainer)
|
|
Name = x.Value
|
|
Site = x.Attribute(Name_Site).Value
|
|
Plugin = x.Attribute(Name_Plugin).Value
|
|
IsSubscription = x.Attribute(Name_IsSubscription).Value.FromXML(Of Boolean)(False)
|
|
CollectionName = x.Attribute(Name_Collection).Value
|
|
CollectionModel = x.Attribute(Name_Model_Collection).Value.FromXML(Of Integer)(UsageModel.Default)
|
|
UserModel = x.Attribute(Name_Model_User).Value.FromXML(Of Integer)(UsageModel.Default)
|
|
Merged = x.Attribute(Name_Merged).Value.FromXML(Of Boolean)(False)
|
|
SpecialPath = SFile.GetPath(x.Attribute(Name_SpecialPath).Value)
|
|
SpecialCollectionPath = SFile.GetPath(x.Attribute(Name_SpecialCollectionPath).Value)
|
|
If Not x.Attribute(Name_LastSeen).Value.IsEmptyString Then LastSeen = AConvert(Of Date)(x.Attribute(Name_LastSeen).Value, DateTimeDefaultProvider, Nothing)
|
|
UpdateUserFile()
|
|
End Sub
|
|
Friend Sub New(ByVal c As Reddit.Channel)
|
|
Name = c.Name
|
|
Site = Reddit.RedditSite
|
|
Plugin = Reddit.RedditSiteKey
|
|
File = c.File
|
|
End Sub
|
|
Public Shared Widening Operator CType(ByVal x As EContainer) As UserInfo
|
|
Return New UserInfo(x)
|
|
End Operator
|
|
Public Shared Widening Operator CType(ByVal u As UserInfo) As String
|
|
Return u.Name
|
|
End Operator
|
|
#End Region
|
|
#Region "Operators"
|
|
Public Shared Operator =(ByVal x As UserInfo, ByVal y As UserInfo)
|
|
Return x.Equals(y)
|
|
End Operator
|
|
Public Shared Operator <>(ByVal x As UserInfo, ByVal y As UserInfo)
|
|
Return Not x.Equals(y)
|
|
End Operator
|
|
#End Region
|
|
#Region "ToString"
|
|
Public Overrides Function ToString() As String
|
|
Return Name
|
|
End Function
|
|
#End Region
|
|
#Region "FilePath"
|
|
Friend Const CollectionUserPathPattern As String = "{0}\{1}_{2}\"
|
|
Friend Sub UpdateUserFile()
|
|
File = New SFile With {
|
|
.Separator = "\",
|
|
.Path = GetFilePathByParams(),
|
|
.Extension = "xml",
|
|
.Name = $"{UserDataBase.UserFileAppender}_{Site}_{Name}"
|
|
}
|
|
End Sub
|
|
Friend Function GetCollectionRootPath() As SFile
|
|
If IncludedInCollection And Not IsVirtual Then
|
|
Dim ColPath$ = If(SpecialCollectionPath.IsEmptyString, Settings.CollectionsPathF, SpecialCollectionPath).PathNoSeparator
|
|
If SpecialCollectionPath.IsEmptyString Then ColPath &= $"\{CollectionName}"
|
|
Return ColPath.CSFileP
|
|
Else
|
|
Return Nothing
|
|
End If
|
|
End Function
|
|
Private Function GetFilePathByParams() As String
|
|
If [Protected] Then Return String.Empty
|
|
If IsSubscription Then
|
|
If Not Settings(Plugin) Is Nothing Then
|
|
Return $"{Application.StartupPath.CSFilePSN}\{SettingsFolderName}\Subscriptions\{Settings(Plugin).Key}\{Name}\{SettingsFolderName}"
|
|
Else
|
|
Return String.Empty
|
|
End If
|
|
Else
|
|
Dim ColPath$ = GetCollectionRootPath().PathNoSeparator
|
|
If Not SpecialPath.IsEmptyString Then
|
|
Return $"{SpecialPath.PathWithSeparator}{SettingsFolderName}"
|
|
ElseIf Merged And IncludedInCollection Then
|
|
Return $"{ColPath}\{SettingsFolderName}"
|
|
Else
|
|
If IncludedInCollection And Not IsVirtual Then
|
|
Return $"{String.Format(CollectionUserPathPattern, ColPath, Site, Name)}{SettingsFolderName}"
|
|
ElseIf Not Settings(Plugin) Is Nothing Then
|
|
Return $"{Settings(Plugin).Path.PathNoSeparator}\{Name}\{SettingsFolderName}"
|
|
Else
|
|
Dim s$ = Site.ToLower
|
|
Dim i% = Settings.Plugins.FindIndex(Function(p) p.Name.ToLower = s)
|
|
If i >= 0 Then Return $"{Settings.Plugins(i).Settings.Path.PathNoSeparator}\{Name}\{SettingsFolderName}" Else Return String.Empty
|
|
End If
|
|
End If
|
|
End If
|
|
End Function
|
|
#End Region
|
|
#Region "ToEContainer Support"
|
|
Friend Function ToEContainer(Optional ByVal e As ErrorsDescriber = Nothing) As EContainer Implements IEContainerProvider.ToEContainer
|
|
Return New EContainer(Name_UserNode, Name, {New EAttribute(Name_Site, Site),
|
|
New EAttribute(Name_Plugin, Plugin),
|
|
New EAttribute(Name_IsSubscription, IsSubscription.BoolToInteger),
|
|
New EAttribute(Name_Collection, CollectionName),
|
|
New EAttribute(Name_Model_User, CInt(UserModel)),
|
|
New EAttribute(Name_Model_Collection, CInt(CollectionModel)),
|
|
New EAttribute(Name_Merged, Merged.BoolToInteger),
|
|
New EAttribute(Name_SpecialPath, SpecialPath.PathWithSeparator),
|
|
New EAttribute(Name_SpecialCollectionPath, SpecialCollectionPath.PathWithSeparator),
|
|
New EAttribute(Name_LastSeen, AConvert(Of String)(LastSeen, DateTimeDefaultProvider, String.Empty))})
|
|
End Function
|
|
#End Region
|
|
#Region "IComparable Support"
|
|
Friend Function CompareTo(ByVal Other As UserInfo) As Integer Implements IComparable(Of UserInfo).CompareTo
|
|
If Site = Other.Site Then
|
|
Return Name.CompareTo(Other.Name)
|
|
Else
|
|
Return Site.CompareTo(Other.Site)
|
|
End If
|
|
End Function
|
|
#End Region
|
|
#Region "IEquatable Support"
|
|
Friend Overloads Function Equals(ByVal Other As UserInfo) As Boolean Implements IEquatable(Of UserInfo).Equals
|
|
Return Site.StringToLower = Other.Site.StringToLower And Name.StringToLower = Other.Name.StringToLower And
|
|
IsSubscription = Other.IsSubscription And (Not Plugin = PathPlugin.PluginKey Or SpecialPath = Other.SpecialPath)
|
|
End Function
|
|
Public Overloads Overrides Function Equals(ByVal Obj As Object) As Boolean
|
|
Return Equals(DirectCast(Obj, UserInfo))
|
|
End Function
|
|
#End Region
|
|
End Structure
|
|
End Module |