ProSol.Html.TagsProvider 2.0.0

dotnet add package ProSol.Html.TagsProvider --version 2.0.0                
NuGet\Install-Package ProSol.Html.TagsProvider -Version 2.0.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="ProSol.Html.TagsProvider" Version="2.0.0" />                
For projects that support PackageReference, copy this XML node into the project file to reference the package.
paket add ProSol.Html.TagsProvider --version 2.0.0                
#r "nuget: ProSol.Html.TagsProvider, 2.0.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.
// Install ProSol.Html.TagsProvider as a Cake Addin
#addin nuget:?package=ProSol.Html.TagsProvider&version=2.0.0

// Install ProSol.Html.TagsProvider as a Cake Tool
#tool nuget:?package=ProSol.Html.TagsProvider&version=2.0.0                

ProSol.Html.TagsProvider

TagsProvider is a tool for extracting HTML tags from a string, in event-driven way. Helps to extract text, structured data, from a specific site.

How to use?

Install the package:

dotnet add package ProSol.Html.TagsProvider --version 2.0.0-rc1.3

Fetch some html:
```csharp
var url = "https://en.wikipedia.org/wiki/Food_energy";
var html = HtmlSource.GetHtmlAsync(url).Result;

Process all a tag:

var provider = new TagsProvider();
var data = new DataSubscriber<string>();

provider
    .Endpoint(x => x.CurrentTag.TagInfo.Name == "a")
    .Translate(x => html[x.CurrentTag.InnerTextRange])
    .Subscribe(data);

provider.Process(html);

foreach (var item in data.Messages)
{
    Console.WriteLine(item);
}
internal static class HtmlSource
{
    internal static async Task<string> GetHtmlAsync(string url)
    {
        using var client = new HttpClient();
        using var response = await client.GetAsync(url);
        return await response.Content.ReadAsStringAsync();
    }
}

That's it! The provider notifies about any tag met and its data:

  • name,
  • range of entire tag,
  • range of inner content.

More demos here.

Happy coding!

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

NuGet packages (1)

Showing the top 1 NuGet packages that depend on ProSol.Html.TagsProvider:

Package Downloads
ProSol.WebScrap

A HTML parser, for extracting the text from a web pages, with CSS selectors.

GitHub repositories

This package is not used by any popular GitHub repositories.

Version Downloads Last updated
2.0.0 666 12/8/2023
2.0.0-rc2.0 74 12/8/2023
2.0.0-rc1.4 64 12/5/2023
2.0.0-rc1.3 91 12/2/2023
2.0.0-rc1.2 73 12/2/2023
2.0.0-rc1.1 78 12/2/2023
2.0.0-rc1.0 68 12/2/2023
2.0.0-rc0.5 96 11/24/2023
2.0.0-rc0.4 84 11/23/2023
2.0.0-rc0.3 79 11/23/2023
2.0.0-rc0.2 78 11/21/2023
2.0.0-rc0.1 81 11/19/2023
1.0.2 464 11/7/2023
1.0.1-a 398 11/7/2023