Extruct.Net 0.18.0

dotnet add package Extruct.Net --version 0.18.0
                    
NuGet\Install-Package Extruct.Net -Version 0.18.0
                    
This command is intended to be used within the Package Manager Console in Visual Studio, as it uses the NuGet module's version of Install-Package.
<PackageReference Include="Extruct.Net" Version="0.18.0" />
                    
For projects that support PackageReference, copy this XML node into the project file to reference the package.
<PackageVersion Include="Extruct.Net" Version="0.18.0" />
                    
Directory.Packages.props
<PackageReference Include="Extruct.Net" />
                    
Project file
For projects that support Central Package Management (CPM), copy this XML node into the solution Directory.Packages.props file to version the package.
paket add Extruct.Net --version 0.18.0
                    
#r "nuget: Extruct.Net, 0.18.0"
                    
#r directive can be used in F# Interactive and Polyglot Notebooks. Copy this into the interactive tool or source code of the script to reference the package.
#:package Extruct.Net@0.18.0
                    
#:package directive can be used in C# file-based apps starting in .NET 10 preview 4. Copy this into a .cs file before any lines of code to reference the package.
#addin nuget:?package=Extruct.Net&version=0.18.0
                    
Install as a Cake Addin
#tool nuget:?package=Extruct.Net&version=0.18.0
                    
Install as a Cake Tool

Extruct.Net

A .NET port of the Python extruct library by Scrapinghub. Extracts embedded metadata from HTML documents across all major structured-data formats.

Supported formats

Syntax Key Standard
JSON-LD json-ld json-ld.org
Microdata microdata WHATWG Microdata
Open Graph opengraph ogp.me
RDFa rdfa W3C RDFa
Microformats microformat microformats.org
Dublin Core dublincore Dublin Core

Library usage

using Extruct;

string html = File.ReadAllText("page.html");

ExtructResult result = Extractor.Extract(
    html,
    baseUrl: "https://example.com/page");

// Access a specific syntax
JsonArray jsonLd = result["json-ld"];
JsonArray microdata = result["microdata"];

// Serialize the full result
Console.WriteLine(result.ToJsonString());

Selecting syntaxes

ExtructResult result = Extractor.Extract(html,
    syntaxes: ["json-ld", "opengraph"]);

Uniform output

Normalizes supported formats (Microdata, Open Graph, Dublin Core, Microformats) to a JSON-LD-like shape with @type and @context:

ExtructResult result = Extractor.Extract(html,
    uniform: true,
    schemaContext: "http://schema.org");

Error handling

// Strict (default): throws on extractor failure
// Log: writes to Console.Error and continues
// Ignore: silently skips failed extractors

ExtructResult result = Extractor.Extract(html, errors: ErrorMode.Log);

// Override the log handler
Extractor.LogHandler = (message, ex) => logger.LogWarning(ex, message);

CLI

extruct [fetch|parse] <url-or-file> [options]

Fetch a URL

extruct fetch https://example.com/product

Parse a local file

extruct parse page.html
extruct parse page.html --base-url https://example.com/page

Options

Option Default Description
--syntaxes all Comma-separated list: microdata,opengraph,json-ld,microformat,rdfa,dublincore
--uniform false Normalize output to a uniform shape
--with-og-array false Keep repeated Open Graph properties as arrays (uniform mode only)
--schema-context http://schema.org Context URL used by the uniform transform
--errors log Error handling: strict, log, or ignore

Examples

# Extract only JSON-LD and Open Graph
extruct fetch https://example.com --syntaxes json-ld,opengraph

# Uniform output for structured data
extruct parse page.html --uniform --syntaxes microdata,json-ld

# Suppress extractor errors
extruct fetch https://example.com --errors ignore

Output format

The output mirrors the Python library exactly: a JSON object keyed by syntax name, each value an array of extracted items.

{
  "json-ld": [
    { "@context": "https://schema.org", "@type": "Product", "name": "..." }
  ],
  "opengraph": [
    {
      "namespace": { "og": "http://ogp.me/ns#" },
      "properties": [["og:title", "..."], ["og:image", "..."]]
    }
  ],
  "microdata": [],
  "rdfa": [],
  "microformat": [],
  "dublincore": []
}

Dependencies

License

BSD 3-Clause

Product Compatible and additional computed target framework versions.
.NET 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. 
Compatible target framework(s)
Included target framework(s) (in package)
Learn more about Target Frameworks and .NET Standard.

NuGet packages

This package is not used by any NuGet packages.

GitHub repositories

This package is not used by any popular GitHub repositories.

Version Downloads Last Updated
0.18.0 89 7/6/2026