Soenneker.Html.Parser 11.0.1453

Prefix Reserved
dotnet add package Soenneker.Html.Parser --version 11.0.1453
                    
NuGet\Install-Package Soenneker.Html.Parser -Version 11.0.1453
                    
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="Soenneker.Html.Parser" Version="11.0.1453" />
                    
For projects that support PackageReference, copy this XML node into the project file to reference the package.
<PackageVersion Include="Soenneker.Html.Parser" Version="11.0.1453" />
                    
Directory.Packages.props
<PackageReference Include="Soenneker.Html.Parser" />
                    
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 Soenneker.Html.Parser --version 11.0.1453
                    
#r "nuget: Soenneker.Html.Parser, 11.0.1453"
                    
#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 Soenneker.Html.Parser@11.0.1453
                    
#: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=Soenneker.Html.Parser&version=11.0.1453
                    
Install as a Cake Addin
#tool nuget:?package=Soenneker.Html.Parser&version=11.0.1453
                    
Install as a Cake Tool

alternate text is missing from this package README image alternate text is missing from this package README image alternate text is missing from this package README image alternate text is missing from this package README image alternate text is missing from this package README image

Soenneker.Html.Parser

Downloads and parses HTML with AngleSharp, with helpers for extracting anchors and image URLs.

Install

dotnet add package Soenneker.Html.Parser

Register

using Soenneker.Html.Parser.Registrars;

services.AddHtmlParserUtilAsSingleton();

Use AddHtmlParserUtilAsScoped() when the parser and its HTTP client should be owned by a dependency-injection scope.

Parse HTML

using AngleSharp.Dom;
using Soenneker.Html.Parser.Abstract;

IDocument document = await parser.Parse(html, cancellationToken);

string? title = document.QuerySelector("title")?.TextContent;
IElement? heading = document.QuerySelector("main h1");

AngleSharp parses with browser-style error recovery, so malformed markup may produce a repaired document rather than an exception.

List<string> anchors = await parser.GetAllAnchors(
    "https://example.com/docs",
    cancellationToken);

(List<string> pageAnchors, List<string> images) =
    await parser.GetAnchorsAndImageUrls(
        "https://example.com/docs",
        cancellationToken);

Anchor helpers return unique, non-empty href strings exactly as written in the document; relative links are not resolved. The combined helper downloads and parses the page once.

Extract image URLs from existing HTML

List<string> images = await parser.GetAllUrlsFromImgTagsFromHtml(
    html,
    "https://example.com/catalog/",
    cancellationToken);

This reads img[src], resolves relative values against the base URI, and returns unique HTTP(S) URLs. Data, JavaScript, file, and other schemes are ignored.

GetAllImageUrlsViaRegexFromHtml() is a separate text scan for absolute HTTP(S) image URLs ending in a common image extension. It does not understand HTML, resolve relative paths, inspect srcset, or retain query strings after the extension; prefer the DOM-based helper for normal pages.

The download APIs use HttpClient.GetStringAsync, require a successful response, and buffer the response body as a string. Do not expose arbitrary user-supplied URLs to these methods without applying your application's SSRF controls.

Product Compatible and additional computed target framework versions.
.NET net11.0 is compatible. 
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
11.0.1453 0 11/25/2026
11.0.1452 57 11/19/2026
11.0.1451 63 11/19/2026
11.0.1450 75 11/18/2026
11.0.1449 59 11/18/2026
11.0.1448 67 11/18/2026
11.0.1447 61 11/18/2026
11.0.1446 101 11/16/2026
11.0.1445 97 11/15/2026
11.0.1444 99 11/15/2026
11.0.1443 102 11/15/2026
11.0.1442 96 11/14/2026
11.0.1441 97 11/12/2026
11.0.1440 100 11/11/2026
11.0.1439 93 11/11/2026
11.0.1438 93 11/11/2026
11.0.1435 99 11/11/2026
11.0.1434 86 11/11/2026
11.0.1433 91 11/11/2026
11.0.1432 97 11/11/2026
Loading failed

Update dependency Soenneker.AngleSharp.Parser to 11.0.140 (#2020)