WebReaper.Extraction.Attributes
11.3.0
dotnet add package WebReaper.Extraction.Attributes --version 11.3.0
NuGet\Install-Package WebReaper.Extraction.Attributes -Version 11.3.0
<PackageReference Include="WebReaper.Extraction.Attributes" Version="11.3.0" />
<PackageVersion Include="WebReaper.Extraction.Attributes" Version="11.3.0" />
<PackageReference Include="WebReaper.Extraction.Attributes" />
paket add WebReaper.Extraction.Attributes --version 11.3.0
#r "nuget: WebReaper.Extraction.Attributes, 11.3.0"
#:package WebReaper.Extraction.Attributes@11.3.0
#addin nuget:?package=WebReaper.Extraction.Attributes&version=11.3.0
#tool nuget:?package=WebReaper.Extraction.Attributes&version=11.3.0
WebReaper.Extraction.Attributes
[ScrapeSchema] and [ScrapeField] marker attributes for WebReaper's Roslyn source generator. Consumed by WebReaper.Extraction.Generators at compile time. Lightweight; no runtime dependencies beyond the BCL.
Install
You usually want both packages together:
dotnet add package WebReaper.Extraction.Attributes
dotnet add package WebReaper.Extraction.Generators
What's in this package
Multi-targeted to netstandard2.0 (so the Roslyn analyzer can reference it) and net10.0 (so user code can use it at runtime). Ships three public types:
| Type | Purpose |
|---|---|
[ScrapeSchema] |
Class-level marker. The source generator emits a static Schema Schema and a static Materialize(JsonObject) on partial classes carrying this attribute. |
[ScrapeField(selector, ...)] |
Property-level marker. Maps a CSS selector to a property; supports Type, IsList, Attr parameters. |
SchemaFieldType |
Enum (String, Integer, Float, Boolean, Datetime) for typed field coercion. |
Quick start
using WebReaper.Extraction.Attributes;
[ScrapeSchema]
public partial class Article
{
[ScrapeField("h1")]
public string? Title { get; set; }
[ScrapeField(".views", Type = SchemaFieldType.Integer)]
public int Views { get; set; }
[ScrapeField(".tag", IsList = true)]
public List<string> Tags { get; set; } = new();
[ScrapeField("a.permalink", Attr = "href")]
public string? Permalink { get; set; }
}
The WebReaper.Extraction.Generators Roslyn analyzer emits, at compile time:
public partial class Article
{
public static Schema Schema { get; }
public static Article Materialize(JsonObject json) { ... }
}
No reflection at runtime; AOT-clean. Schema typos become compile errors.
See also
- Main repo: github.com/pavlovtech/WebReaper
- The source generator:
WebReaper.Extraction.Generators - Design: ADR-0045
- License: MIT
| Product | Versions Compatible and additional computed target framework versions. |
|---|---|
| .NET | net5.0 was computed. net5.0-windows was computed. net6.0 was computed. net6.0-android was computed. net6.0-ios was computed. net6.0-maccatalyst was computed. net6.0-macos was computed. net6.0-tvos was computed. net6.0-windows was computed. net7.0 was computed. net7.0-android was computed. net7.0-ios was computed. net7.0-maccatalyst was computed. net7.0-macos was computed. net7.0-tvos was computed. net7.0-windows was computed. net8.0 was computed. net8.0-android was computed. net8.0-browser was computed. net8.0-ios was computed. net8.0-maccatalyst was computed. net8.0-macos was computed. net8.0-tvos was computed. net8.0-windows was computed. net9.0 was computed. net9.0-android was computed. net9.0-browser was computed. net9.0-ios was computed. net9.0-maccatalyst was computed. net9.0-macos was computed. net9.0-tvos was computed. net9.0-windows was computed. net10.0 is compatible. net10.0-android was computed. net10.0-browser was computed. net10.0-ios was computed. net10.0-maccatalyst was computed. net10.0-macos was computed. net10.0-tvos was computed. net10.0-windows was computed. |
| .NET Core | netcoreapp2.0 was computed. netcoreapp2.1 was computed. netcoreapp2.2 was computed. netcoreapp3.0 was computed. netcoreapp3.1 was computed. |
| .NET Standard | netstandard2.0 is compatible. netstandard2.1 was computed. |
| .NET Framework | net461 was computed. net462 was computed. net463 was computed. net47 was computed. net471 was computed. net472 was computed. net48 was computed. net481 was computed. |
| MonoAndroid | monoandroid was computed. |
| MonoMac | monomac was computed. |
| MonoTouch | monotouch was computed. |
| Tizen | tizen40 was computed. tizen60 was computed. |
| Xamarin.iOS | xamarinios was computed. |
| Xamarin.Mac | xamarinmac was computed. |
| Xamarin.TVOS | xamarintvos was computed. |
| Xamarin.WatchOS | xamarinwatchos was computed. |
-
.NETStandard 2.0
- No dependencies.
-
net10.0
- No dependencies.
NuGet packages
This package is not used by any NuGet packages.
GitHub repositories
This package is not used by any popular GitHub repositories.
10.0.1: NuGet metadata polish. Adds PackageIcon + PackageReadmeFile so the package displays a logo and README on its NuGet page. Removes em-dash from the previous release notes. No code changes. 10.0.0: initial release. The [ScrapeSchema] and [ScrapeField] attributes plus SchemaFieldType consumed by the WebReaper.Extraction.Generators Roslyn source generator (ADR-0045). Multi-targeted to netstandard2.0 (so the analyzer can reference it) and net10.0 (so user code can use it at runtime). Lightweight, no runtime deps beyond the BCL. Pairs with WebReaper.Extraction.Generators; requires WebReaper 10.0.0 at runtime.