f52aa6123b
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.
13 lines
514 B
C#
13 lines
514 B
C#
using System.Text;
|
|
using Beam.Abstractions;
|
|
using Microsoft.Extensions.Logging;
|
|
|
|
namespace Beam.Stealth.Strategies;
|
|
|
|
internal class PageDownloadStrategy : IDownloadStrategy {
|
|
public async Task DownloadToStream(string url, int bufferSize, Stream destinationStream, IProgress<IDownloadReport> progress, StealthConfig config,
|
|
ILogger? logger, CancellationToken ct) {
|
|
byte[] bytes = Encoding.UTF8.GetBytes(config.Driver.PageSource);
|
|
await destinationStream.WriteAsync(bytes, ct);
|
|
}
|
|
} |