NScrape 1.0.0

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

NScrape

A web scraping framework for .NET that handles the plumbing — HTTP requests, cookies, redirects, form submission — so you can focus on extracting data.

Installation

dotnet add package NScrape

Quick Start

This example scrapes the book category list from books.toscrape.com.

1. Create a scraper

Inherit from Scraper and use the HTML Agility Pack HtmlDocument to extract data:

using NScrape;

public class BookstoreScraper : Scraper {
    public BookstoreScraper( string html ) : base( html ) { }

    public List<string> GetTitles() {
        return HtmlDocument.DocumentNode
            .Descendants( "article" )
            .Where( n => n.Attributes["class"]?.Value == "product_pod" )
            .Select( n => n.SelectSingleNode( ".//h3/a" ).Attributes["title"].Value )
            .ToList();
    }
}

2. Fetch the page and scrape it

using NScrape;
using NScrape.Interfaces;

var webClient = new WebClient();

using var response = webClient.SendRequest( new Uri( "https://books.toscrape.com" ) );

if ( response is IHtmlWebResponse htmlResponse ) {
    var scraper = new BookstoreScraper( htmlResponse.Html );
    var titles = scraper.GetTitles();
}

Features

  • GET and POST requests
  • Cookie management
  • Automatic redirect handling
  • HTML form submission (BasicHtmlForm, BasicAspxForm)
  • Proxy support
  • Extensible response handling via custom content type handlers

Proxy Support

NScrape supports routing requests through a proxy at either the client or per-request level:

// Client-level proxy — applies to all requests
webClient.Proxy = new WebProxy( "http://your-proxy:port" );

// Per-request proxy — overrides client proxy for this request
var request = new GetWebRequest( uri ) {
    Proxy = new WebProxy( "http://your-proxy:port" )
};

For reliable scraping at scale, a dedicated proxy service such as ScrapingAnt (affiliate link) can help manage proxy rotation and avoid blocks.

Requirements

.NET 8.0 or later

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.  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 was computed.  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
1.0.0 134 7/17/2026
0.4.1 16,380 3/1/2019
0.4.0 2,224 7/13/2018
0.3.0 3,903 9/21/2016
0.2.0 2,238 12/4/2015
0.1.0 1,943 8/12/2015

Version 1.0.0 — Breaking changes release. See full release notes at
     https://github.com/darrylwhitmore/NScrape/releases/tag/v1.0.0