{"id":22938430,"url":"https://github.com/jacraig/spidey","last_synced_at":"2025-08-12T18:33:25.541Z","repository":{"id":141486588,"uuid":"105015620","full_name":"JaCraig/Spidey","owner":"JaCraig","description":"A multi threaded web crawler library that is generic enough to allow different engines to be swapped in.","archived":false,"fork":false,"pushed_at":"2024-04-12T00:57:33.000Z","size":17855,"stargazers_count":11,"open_issues_count":0,"forks_count":3,"subscribers_count":5,"default_branch":"master","last_synced_at":"2024-04-12T09:21:41.197Z","etag":null,"topics":["crawler","webcrawler"],"latest_commit_sha":null,"homepage":"https://jacraig.github.io/Spidey/","language":"C#","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"apache-2.0","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/JaCraig.png","metadata":{"files":{"readme":"README.md","changelog":"CHANGELOG.md","contributing":"CONTRIBUTING.md","funding":null,"license":"LICENSE","code_of_conduct":"CODE_OF_CONDUCT.md","threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":"SECURITY.md","support":null,"governance":null,"roadmap":null,"authors":null,"dei":null}},"created_at":"2017-09-27T12:30:00.000Z","updated_at":"2024-04-15T01:42:39.380Z","dependencies_parsed_at":null,"dependency_job_id":"23385b96-ef2d-4bf9-9712-9a1d372a0096","html_url":"https://github.com/JaCraig/Spidey","commit_stats":null,"previous_names":[],"tags_count":80,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/JaCraig%2FSpidey","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/JaCraig%2FSpidey/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/JaCraig%2FSpidey/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/JaCraig%2FSpidey/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/JaCraig","download_url":"https://codeload.github.com/JaCraig/Spidey/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":229700240,"owners_count":18109944,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["crawler","webcrawler"],"created_at":"2024-12-14T12:17:55.849Z","updated_at":"2025-08-12T18:33:25.528Z","avatar_url":"https://github.com/JaCraig.png","language":"C#","funding_links":[],"categories":[],"sub_categories":[],"readme":"# \u003cimg src=\"https://jacraig.github.io/Spidey/images/icon.png\" style=\"height:25px\" alt=\"Spidey Icon\" /\u003e Spidey\n\n[![.NET Publish](https://github.com/JaCraig/Spidey/actions/workflows/dotnet-publish.yml/badge.svg)](https://github.com/JaCraig/Spidey/actions/workflows/dotnet-publish.yml) [![NuGet](https://img.shields.io/nuget/v/Spidey.svg)](https://www.nuget.org/packages/Spidey/)\n\nSpidey is a flexible and extensible .NET library for crawling web content. It is designed for .NET Core applications and provides a modular architecture, allowing you to customize or extend any part of the crawling pipeline.\n\n## Features\n\n- Simple API for crawling websites\n- Highly configurable via the `Options` class\n- Dependency injection support (IoC/DI)\n- Easily replaceable subsystems (engine, parser, scheduler, etc.)\n- Callback-based result handling\n- NuGet package available\n\n## Quick Start\n\nInstall the NuGet package:\n\n```powershell\ndotnet add package Spidey\n```\n\n## Setting up the Library\n\nRegister Spidey in your app's service collection using the `RegisterSpidey` extension method:\n\n```csharp\nusing Microsoft.Extensions.DependencyInjection;\nusing Spidey;\n\nvar services = new ServiceCollection();\nservices.RegisterSpidey();\n\n// Optionally, register your Options configuration\nservices.AddSingleton(new Options\n{\n    ItemFound = result =\u003e Console.WriteLine($\"Found: {result.Url}\"),\n    Allow = new List\u003cstring\u003e { \"http://mywebsite\", \"http://mywebsite2\" },\n    FollowOnly = new List\u003cstring\u003e { /* regex patterns */ },\n    Ignore = new List\u003cstring\u003e { /* regex patterns */ },\n    StartLocations = new List\u003cstring\u003e { \"http://mywebsite\", \"http://mywebsite2\" },\n    UrlReplacements = new Dictionary\u003cstring, string\u003e { /* { \"old\", \"new\" } */ },\n    // Other options as needed\n});\n\nvar provider = services.BuildServiceProvider();\nvar crawler = provider.GetRequiredService\u003cCrawler\u003e();\n```\n\nAlternatively, you can instantiate `Crawler` and `Options` directly without DI:\n\n```csharp\nvar options = new Options\n{\n    ItemFound = result =\u003e Console.WriteLine($\"Found: {result.Url}\"),\n    // ...other options\n};\nvar crawler = new Crawler(options);\n```\n\n## Options Configuration\n\nThe `Options` class configures the crawler's behavior. Key properties include:\n\n- `ItemFound` (`Action\u003cResultFile\u003e`): Callback invoked when a new page is discovered.\n- `Allow` (`List\u003cstring\u003e`): Regex patterns for URLs allowed to be crawled.\n- `FollowOnly` (`List\u003cstring\u003e`): Regex patterns for pages whose links should be followed.\n- `Ignore` (`List\u003cstring\u003e`): Regex patterns for URLs to ignore.\n- `StartLocations` (`List\u003cstring\u003e`): Initial URLs to start crawling from.\n- `UrlReplacements` (`Dictionary\u003cstring, string\u003e`): URL replacements during crawling.\n- `NetworkCredentials` (`NetworkCredential`): Optional credentials for authentication.\n- `UseDefaultCredentials` (`bool`): Use default system credentials.\n- `Proxy` (`IWebProxy`): Optional proxy settings.\n\nExample callback method:\n\n```csharp\nvoid OnItemFound(ResultFile result)\n{\n    Console.WriteLine($\"Discovered: {result.Url} (Status: {result.StatusCode})\");\n    // Additional processing...\n}\n```\n\n## Basic Usage\n\nOnce configured, start the crawl process:\n\n```csharp\ncrawler.StartCrawl();\n```\n\nThe library will handle link discovery, content downloading, and result parsing. Your callback will be invoked for each discovered item.\n\n## Customization\n\nSpidey is built with extensibility in mind. The system is divided into the following subsystems, each replaceable via DI:\n\n1. **Content Parser (`IContentParser`)** – Parses downloaded data into `ResultFile` objects.\n2. **Engine (`IEngine`)** – Handles HTTP requests and content downloading.\n3. **Link Discoverer (`ILinkDiscoverer`)** – Extracts links from content.\n4. **Processor (`IProcessor`)** – Processes parsed content (default: invokes your callback).\n5. **Scheduler (`IScheduler`)** – Manages work distribution.\n6. **Pipeline (`IPipeline`)** – Orchestrates the crawling process.\n\nTo customize, implement the relevant interface from `Spidey.Engines.Interfaces` and register your implementation in the service provider. Note that if you call RegisterSpidey(), the registration is handled for you automatically. If you instantiate `Crawler` directly, you must compose the pipeline manually.\n\n## FAQ\n\n**Q: Can I run the crawler on multiple nodes?**\n\nA: The default scheduler is single-node only. For distributed crawling, implement a custom scheduler (e.g., using a database or message queue) to coordinate work between instances.\n\n## Build Process\n\nRequirements:\n\n- Visual Studio 2022\n\nClone the project and open the solution (`Spidey.sln`) in Visual Studio to build.\n\n## License\n\nSee [LICENSE](LICENSE) for details.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fjacraig%2Fspidey","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fjacraig%2Fspidey","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fjacraig%2Fspidey/lists"}