mirror of
https://github.com/xboxeer/NScrapy.git
synced 2026-10-28 20:12:39 +08:00
- Add new NScrapy.Core project with Fluent API for spider creation - Add Fluent/NScrapy.cs - Static entry class with CreateSpider(name) - Add Fluent/ISpiderBuilder.cs - Builder interface for fluent configuration - Add Fluent/SpiderBuilder.cs - Builder implementation - Add Fluent/IDistributedBuilder.cs - Distributed config interface - Add Fluent/DistributedBuilder.cs - Distributed config implementation - Add Fluent/ISpider.cs - New spider runtime interface - Add Fluent/Spider.cs - Spider implementation inheriting from base Spider - Add Fluent/SpiderOptions.cs - Configuration options class - Add Middleware/JsRenderMiddleware.cs - Stub middleware (not implemented) - Update solution file to include NScrapy.Core project
25 lines
847 B
C#
25 lines
847 B
C#
using System.Collections.Generic;
|
|
|
|
namespace NScrapy
|
|
{
|
|
public class SpiderOptions
|
|
{
|
|
public int Concurrency { get; set; } = 10;
|
|
public int DelayMs { get; set; } = 0;
|
|
public ICollection<string> UserAgents { get; set; } = new List<string>();
|
|
public int MaxRetries { get; set; } = 3;
|
|
public int TimeoutMs { get; set; } = 30000;
|
|
public string SchedulerType { get; set; } = "NScrapy.Scheduler.InMemoryScheduler";
|
|
|
|
// Distributed configuration
|
|
internal DistributedConfig DistributedConfig { get; set; }
|
|
}
|
|
|
|
public class DistributedConfig
|
|
{
|
|
public string RedisConnectionString { get; set; } = "localhost:6379";
|
|
public string ReceiverQueue { get; set; } = "nscrapy:requests";
|
|
public string ResponseQueue { get; set; } = "nscrapy:responses";
|
|
}
|
|
}
|