Refactor data providers and update abstractions
- Removed obsolete data providers: `AnchorCollectionDataProvider`, `ContentsDataProvider`, and others, consolidating logic into new composable providers. - Added `ComposeDataProviders`, `SelectDataProvider`, and `RelationalDataProvider` for improved flexibility and reusability. - Introduced `IManySelectionComposableDataProvider` interface to support multiple-node selection. - Enhanced `UnitDownloader` with more robust progress tracking. - Updated package references and project dependencies for consistency. - Improved error handling in `StealthConfig` initialization for better fallback on browser drivers. - Incremented project version to 2.4.5.
This commit is contained in:
@@ -0,0 +1,20 @@
|
||||
using Beam.Abstractions;
|
||||
using HtmlAgilityPack;
|
||||
|
||||
namespace Beam.Dynamic;
|
||||
|
||||
public class ManyAnchorsDataProvider : AnchorDataProvider, IManySelectionComposableDataProvider<string[]> {
|
||||
public new string[] Get(HtmlDocument document) {
|
||||
return [base.Get(document)];
|
||||
}
|
||||
public string[] ManyGet(HtmlNode[] node) {
|
||||
return node.Select(x => base.Get(x)).ToArray();
|
||||
}
|
||||
public HtmlNode[]? SelectMany(HtmlDocument doc) {
|
||||
var k = Select(doc);
|
||||
return k == null ? null : [k];
|
||||
}
|
||||
public HtmlNode[]? SelectMany(HtmlNode[] node) {
|
||||
return node.Select(x => Select(x) ?? null).Where(x => x is not null).Cast<HtmlNode>().ToArray();
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user