liguobao / MovieCrawler

Movie Crawler

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

关于 发布后 返回400 bad request

huanghuangboy opened this issue · comments

你好。爬虫程序 在本地 调试 爬取页面正常,但是发布在Ubuntu后,爬取的时候返回400 Bad Request,这是什么原因导致的?

把response log 一下看看,如果是抛一场了,估计Nlog文件夹下面的log文件有对应的日志的.
我猜测是直接被dy2018发现是爬虫程序了.

我爬的不是 DY2018,是另一个utf-8编码的网站,是尝试过,不管请求哪一个网站,返回都是400 bad request。我的代码是:
HttpHelpers httpHelpers = new HttpHelpers(); HttpItems items = new HttpItems(); //解析数据 HtmlDocument doc = new HtmlDocument(); items.Url = "http://www.id97.com/";//请求地址 items.Method = "Get";//请求方式 post HttpResults hrMain = httpHelpers.GetHtml(items); _logger.LogInformation("爬取资源中" + items.Url); _logger.LogInformation(hrMain.Html); //加载html doc.LoadHtml(hrMain.Html);

你直接用http client请求数据看看