Spidey 5.0.131

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

// Install Spidey as a Cake Tool
#tool nuget:?package=Spidey&version=5.0.131                

Spidey

.NET Publish

Library to help with crawling web content. Compatible with .Net Core and .Net Framework.

Setting up the Library

Spidey relies on Canister in order to hook itself up. In order for this to work, you must do the following at startup:

new ServiceCollection().AddCanisterModules();

The AddCanisterModules function is an extension method that registers it with the IoC container. When this is done, Spidey is ready to use.

Basic Usage

Spidey really boils down to using one class called Crawler:

ServiceCollection.AddSingleton(new Options
			{
			    ItemFound = FoundFile=>{}                                            //The callback method used when a new page is discovered.
			    Allow = new List<string> { "http://mywebsite", "http://mywebsite2" },    //Regexes of what sites/pages are allowed to be crawled.
			    FollowOnly = new List<string> { "..." },                                 //Regexes of pages to only follow links that are found on them.
			    Ignore = new List<string> { "..." },                                     //Regexes that the system will ignore when they are encountered.
			    StartLocations = new List<string> { "http://mywebsite", "http://mywebsite2" },    //Starting URLs for the crawler.
			    UrlReplacements = new Dictionary<string,string> {...}                    //When the system hits one of the keys in the dictionary, it will replace it with the value.
			});
			

Note that it is recommended that you actually register the Options object in your ServiceCollection and resolve the Crawler object from the service provider but it is not required. You can simply new up an instance of Crawler if you want. Anyway, the Options class has a number of properties, some of which are not displayed above such as NetworkCredentials, UseDefaultCredentials, and Proxy. The callback method is what will be called by the system once a link's info has been received and looks like this:

void CallbackMethod(ResultFile obj) { ... }

The library will handle parsing of links found within the page, downloading the content, etc. for the most part. At this point all you have to do is call the StartCrawl method:

MyCrawler.StartCrawl();

Customization

Note that it's possible to customize the crawler's various parts. The system is divided into the following sections:

  1. Content Parser (IContentParser) - This parses the resulting data and converts it to the ResultFile object.
  2. Engine (IEngine) - This downloads the content from the server.
  3. Link Discoverer (ILinkDiscoverer) - Takes the content from the engine and looks for links to other resources.
  4. Processor (IProcessor) - Takes the parsed content and hands it off to your code. The default one simply calls the method provided in the options.
  5. Scheduler (IScheduler) - Handles handing out work to the various workers.
  6. Pipeline (IPipeline) - Manages the various parts of the process by feeding the content to the next bit of the process.

These subsystems all implement interfaces found in the Spidey.Engines.Interfaces namespace. In order to replace the default in any of these systems all you need to do is create a class that implements the interface that you want to replace. After that the system will automatically pick it up if resolved from the service provider. If you, instead, new up a Crawler object then you will need to compose the Pipeline object.

Installation

The library is available via Nuget with the package name "Spidey". To install it run the following command in the Package Manager Console:

Install-Package Spidey

FAQ

  1. Is it possible to run the crawler using multiple nodes?

The default scheduler assumes that you are only running the crawler from one location and doesn't talk to other instances of the application. But it is possible to replace the scheduler with one that will talk via some mechanism like a database to coordinate work between instances and is recommended for more complex setups.

Build Process

In order to build the library you will require the following:

  1. Visual Studio 2019

Other than that, just clone the project and you should be able to load the solution and build without too much effort.

Product Compatible and additional computed target framework versions.
.NET net6.0 is compatible.  net6.0-android was computed.  net6.0-ios was computed.  net6.0-maccatalyst was computed.  net6.0-macos was computed.  net6.0-tvos was computed.  net6.0-windows was computed.  net7.0 was computed.  net7.0-android was computed.  net7.0-ios was computed.  net7.0-maccatalyst was computed.  net7.0-macos was computed.  net7.0-tvos was computed.  net7.0-windows was computed.  net8.0 was computed.  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

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
5.0.131 72 11/12/2024
5.0.130 68 11/11/2024
5.0.129 70 11/6/2024
5.0.128 72 11/5/2024
5.0.127 64 11/4/2024
5.0.126 73 10/31/2024
5.0.125 62 10/30/2024
5.0.124 71 10/29/2024
5.0.123 85 10/11/2024
5.0.122 79 10/10/2024
5.0.121 71 10/9/2024
5.0.120 83 10/2/2024
5.0.119 85 10/1/2024
5.0.118 82 9/24/2024
5.0.117 94 9/17/2024
5.0.116 133 9/10/2024
5.0.115 92 9/3/2024
5.0.114 93 8/30/2024
5.0.113 100 8/27/2024
5.0.112 98 8/26/2024
5.0.111 119 8/23/2024
5.0.110 110 8/21/2024
5.0.109 104 8/20/2024
5.0.108 108 8/16/2024
5.0.107 108 8/15/2024
5.0.106 90 8/5/2024
5.0.105 70 8/2/2024
5.0.104 84 8/1/2024
5.0.103 83 7/26/2024
5.0.102 100 7/11/2024
5.0.101 99 7/2/2024
5.0.100 104 6/27/2024
5.0.99 82 6/26/2024
5.0.98 110 6/19/2024
5.0.97 100 6/18/2024
5.0.96 109 6/17/2024
5.0.95 107 6/14/2024
5.0.94 94 6/13/2024
5.0.93 93 6/12/2024
5.0.92 106 5/31/2024
5.0.91 96 5/30/2024
5.0.90 96 5/17/2024
5.0.89 101 5/16/2024
5.0.88 123 5/8/2024
5.0.87 121 5/7/2024
5.0.86 124 5/6/2024
5.0.85 83 5/3/2024
5.0.84 91 5/2/2024
5.0.83 102 5/1/2024
5.0.82 123 4/30/2024
5.0.81 107 4/16/2024
5.0.80 106 4/12/2024
5.0.79 105 4/11/2024
5.0.78 127 4/1/2024
5.0.77 116 3/29/2024
5.0.76 118 3/18/2024
5.0.75 111 3/15/2024
5.0.74 115 3/14/2024
5.0.73 116 3/11/2024
5.0.72 107 3/8/2024
5.0.71 111 3/7/2024
5.0.70 131 3/6/2024
5.0.69 120 3/5/2024
5.0.68 121 3/4/2024
5.0.67 118 2/29/2024
5.0.66 108 2/28/2024
5.0.65 118 2/26/2024
5.0.64 117 2/23/2024
5.0.63 122 2/22/2024
5.0.62 124 2/21/2024
5.0.61 114 2/16/2024
5.0.60 113 2/15/2024
5.0.59 120 2/12/2024
5.0.58 115 2/8/2024
5.0.57 108 2/7/2024
5.0.56 109 2/6/2024
5.0.55 101 2/1/2024
5.0.54 114 1/31/2024
5.0.53 110 1/30/2024
5.0.52 106 1/24/2024
5.0.51 109 1/23/2024
5.0.50 120 1/12/2024
5.0.49 120 1/11/2024
5.0.48 122 12/26/2023
5.0.47 115 12/22/2023
5.0.46 101 12/18/2023
5.0.45 96 12/15/2023
5.0.44 92 12/14/2023
5.0.43 108 12/13/2023
5.0.42 103 12/12/2023
5.0.41 149 11/24/2023
5.0.40 127 11/21/2023
5.0.39 111 11/20/2023
5.0.38 119 11/17/2023
5.0.37 111 11/16/2023
5.0.36 118 11/14/2023
5.0.35 119 11/8/2023
5.0.34 103 11/7/2023
5.0.33 122 11/6/2023
5.0.32 118 11/1/2023
5.0.31 112 10/31/2023
5.0.30 128 10/30/2023
5.0.29 123 10/26/2023
5.0.28 148 10/12/2023
5.0.27 147 10/5/2023
5.0.26 136 9/26/2023
5.0.25 113 9/20/2023
5.0.24 106 9/19/2023
5.0.23 145 9/18/2023
5.0.22 121 9/14/2023
5.0.21 116 9/13/2023
5.0.20 128 9/11/2023
5.0.19 123 9/7/2023
5.0.18 124 9/6/2023
5.0.17 120 9/5/2023
5.0.16 138 9/4/2023
5.0.15 126 9/1/2023
5.0.14 134 8/31/2023
5.0.13 148 8/30/2023
5.0.12 147 8/29/2023
5.0.11 130 8/25/2023
5.0.10 140 8/23/2023
5.0.9 129 8/18/2023
5.0.8 153 8/10/2023
5.0.7 152 8/8/2023
5.0.6 159 8/8/2023
5.0.5 173 8/7/2023
5.0.4 158 8/3/2023
5.0.3 173 7/26/2023
5.0.2 152 7/20/2023
5.0.1 162 7/14/2023
5.0.0 307 12/12/2022
4.0.5 540 6/10/2022
4.0.2 498 1/11/2022
4.0.1 454 7/19/2021
3.0.9 505 1/7/2021
3.0.7 600 9/13/2020
3.0.6 562 6/26/2020
3.0.5 540 6/26/2020
3.0.3 552 3/25/2020
3.0.2 601 3/1/2020
3.0.1 620 1/1/2020
3.0.0 591 12/23/2019
2.0.15 629 11/22/2019
2.0.14 582 11/22/2019
2.0.13 563 11/22/2019
2.0.12 562 11/21/2019
2.0.11 555 11/21/2019
2.0.10 570 11/21/2019
2.0.9 555 11/21/2019
2.0.8 728 3/3/2019
2.0.7 659 3/3/2019
2.0.6 677 3/3/2019
2.0.5 660 3/3/2019
2.0.4 710 2/7/2019
2.0.3 1,017 6/1/2018
2.0.2 1,003 5/22/2018
2.0.1 1,124 1/2/2018
1.0.12 994 11/2/2017
1.0.11 991 10/30/2017
1.0.10 988 10/26/2017
1.0.9 993 10/26/2017
1.0.8 1,020 10/26/2017
1.0.7 977 10/25/2017
1.0.6 962 10/25/2017
1.0.5 997 10/24/2017
1.0.4 944 10/24/2017
1.0.3 932 10/19/2017
1.0.2 1,067 10/18/2017
1.0.1 988 9/29/2017