Refactor downloaders to use ByteDocument and add options builders

Replaces generic RawType with ByteDocument in downloaders and context classes, simplifying type usage. Adds builder classes for FailurePredicateOptions, FragmentOptions, SkipPredicateOptions, and UnitDownloaderOptions to improve configuration flexibility. Introduces DownloadTarget enum and SkipPredicate delegate for more granular download control. Refactors Fluent API interfaces and implementations to remove RawType generics and streamline usage. Adds Playwright and Stealth download strategies for extensibility.
This commit is contained in:
qwsdcvghyu89
2025-11-15 22:51:46 +11:00
parent 647b2b0f37
commit f52aa6123b
34 changed files with 648 additions and 439 deletions
+3 -3
View File
@@ -8,14 +8,14 @@ namespace Beam.Downloaders {
//public delegate Task<T> AsyncHtmlTransformer<T>(HtmlDocument doc);
//public delegate Task<T> AsyncBinaryTransformer<T>(byte[] bin);
public class DownloadContext<RawType> {
public class DownloadContext {
private bool disposedValue;
public HttpClient Client { get; }
public HtmlWeb Web { get; }
public IProgress<IDownloadReport>? DownloadReporter { get; set; }
public IProgress<IRetryReport>? RetryReporter { get; set; }
public AsyncDownloadFailurePredicate<RawType>?[]? AsyncFailurePredicates { get; }
public AsyncDownloadFailurePredicate<ByteDocument>?[]? AsyncFailurePredicates { get; }
public TimeSpan TimeOut { get; set; }
public IEnumerable<string> Links { get; }
public CancellationToken CancellationToken { get; }
@@ -28,7 +28,7 @@ namespace Beam.Downloaders {
CancellationToken cancellationToken = default,
IProgress<IDownloadReport>? downloadReporter = null,
IProgress<IRetryReport>? retryReporter = null,
AsyncDownloadFailurePredicate<RawType>?[]? asyncFailurePredicates = null,
AsyncDownloadFailurePredicate<ByteDocument>?[]? asyncFailurePredicates = null,
TimeSpan? timeOut = null,
ILogger? downloadLogger = null) {
ArgumentNullException.ThrowIfNull(web, nameof(web));