dotnetcore / DotnetSpider

DotnetSpider, a .NET standard web crawling library. It is lightweight, efficient and fast high-level web crawling & scraping framework
MIT License
3.98k stars 1.04k forks source link

请教下url如何自定义传参 #258

Open onestar1 opened 3 months ago

onestar1 commented 3 months ago

protected override async Task InitializeAsync(CancellationToken stoppingToken = default) { AddDataFlow<DataParser>(); AddDataFlow(GetDefaultStorage); await AddRequestsAsync( new Request( "https://news.cnblogs.com/n/page/1", new Dictionary<string, object> { { "网站", "博客园" } })); }

这里面的 https://news.cnblogs.com/n/page/1 没有办法用传参的形式吗? 还是要修改源码
zlzforever commented 3 months ago

你指的传参的形式是指?

sgf commented 1 month ago

protected override async Task InitializeAsync(CancellationToken stoppingToken = default) { AddDataFlow(); AddDataFlow(GetDefaultStorage); await AddRequestsAsync( new Request( "https://news.cnblogs.com/n/page/1", new Dictionary<string, object> { { "网站", "博客园" } })); }

这里面的 https://news.cnblogs.com/n/page/1 没有办法用传参的形式吗? 还是要修改源码

自己拼接下字符串不就完了么. 你是想要模板化变量化?