feat: introduce new composable data providers and increment version
- Added `AnchorDataProvider`, `AnchorCollectionDataProvider`, `ContentsDataProvider`, `ContentsArrayDataProvider`, `DropDownDataProvider`, `ListContentDataProvider`, and `ParagraphedContentDataProvider` for enhanced data extraction flexibility. - Updated project version to 2.5.0.
This commit is contained in:
@@ -0,0 +1,18 @@
|
||||
using Beam.Abstractions;
|
||||
using HtmlAgilityPack;
|
||||
|
||||
namespace Beam.Dynamic {
|
||||
public class ContentsArrayDataProvider : ContentsDataProvider, IComposableDataProvider<string[]> {
|
||||
public string[] ArrayDelimiters { get; set; } = [";"];
|
||||
|
||||
string[] IDataProvider<string[]>.Get(HtmlDocument document) {
|
||||
var node = Select(document);
|
||||
return node is null ? [] : Get(node);
|
||||
}
|
||||
|
||||
public new string[] Get(HtmlNode node) {
|
||||
return node.InnerText?.Split(ArrayDelimiters, StringSplitOptions.RemoveEmptyEntries) ?? [];
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
Reference in New Issue
Block a user