Soenneker.Html.Parser
11.0.1415
Prefix Reserved
See the version list below for details.
dotnet add package Soenneker.Html.Parser --version 11.0.1415
NuGet\Install-Package Soenneker.Html.Parser -Version 11.0.1415
<PackageReference Include="Soenneker.Html.Parser" Version="11.0.1415" />
<PackageVersion Include="Soenneker.Html.Parser" Version="11.0.1415" />
<PackageReference Include="Soenneker.Html.Parser" />
paket add Soenneker.Html.Parser --version 11.0.1415
#r "nuget: Soenneker.Html.Parser, 11.0.1415"
#:package Soenneker.Html.Parser@11.0.1415
#addin nuget:?package=Soenneker.Html.Parser&version=11.0.1415
#tool nuget:?package=Soenneker.Html.Parser&version=11.0.1415
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.
Download and extract links
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 | Versions Compatible and additional computed target framework versions. |
|---|---|
| .NET | net11.0 is compatible. |
-
net11.0
- Soenneker.AngleSharp.Parser (>= 11.0.118)
- Soenneker.Html.Client (>= 11.0.1145)
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.1422 | 0 | 10/27/2026 |
| 11.0.1421 | 0 | 10/27/2026 |
| 11.0.1420 | 35 | 10/27/2026 |
| 11.0.1419 | 41 | 10/26/2026 |
| 11.0.1418 | 41 | 10/26/2026 |
| 11.0.1415 | 42 | 10/26/2026 |
| 11.0.1414 | 46 | 10/26/2026 |
| 11.0.1413 | 48 | 10/26/2026 |
| 11.0.1412 | 40 | 10/26/2026 |
| 11.0.1411 | 48 | 10/26/2026 |
| 11.0.1410 | 52 | 10/26/2026 |
| 4.0.1409 | 55 | 10/25/2026 |
| 4.0.1408 | 94 | 10/15/2026 |
| 4.0.1407 | 85 | 10/15/2026 |
| 4.0.1406 | 86 | 10/15/2026 |
| 4.0.1405 | 82 | 10/15/2026 |
| 4.0.1404 | 91 | 10/14/2026 |
| 4.0.1403 | 83 | 10/14/2026 |
| 4.0.1400 | 92 | 10/14/2026 |
| 4.0.1399 | 95 | 10/14/2026 |
Updated Multiple NuGet packages