我使用 Portia 网络抓取器创建了一个蜘蛛,起始 URL 是
https://www1.apply2jobs.com/EdwardJonesCareers/ProfExt/index.cfm?fuseaction=mExternal.searchJobs
在 scrapyd 中安排这个蜘蛛时,我得到了
DEBUG: Crawled (200) <GET https://www1.apply2jobs.com/EdwardJonesCareers/ProfExt/index.cfm?fuseaction=mExternal.searchJobs> (referer: None) ['partial']
DEBUG: Crawled (200) <GET https://www1.apply2jobs.com/EdwardJonesCareers/ProfExt/index.cfm?fuseaction=mExternal.returnToResults&CurrentPage=2> (referer: https://www1.apply2jobs.com/EdwardJonesCareers/ProfExt/index.cfm?fuseaction=mExternal.searchJobs) ['partial']
DEBUG: Crawled (200) <GET https://www1.apply2jobs.com/EdwardJonesCareers/ProfExt/index.cfm?fuseaction=mExternal.showJob&RID=21805&CurrentPage=1> (referer: https://www1.apply2jobs.com/EdwardJonesCareers/ProfExt/index.cfm?fuseaction=mExternal.searchJobs) ['partial']`<br><br>
['partial'] 是什么意思,为什么页面内容没有被 spdier 抓取?
请您参考如下方法:
迟到的答案,但希望不是无用的,因为 scrapy 的这种行为似乎没有很好的记录。看着这个line of code从 scrapy 源代码中,当请求遇到 Twisted PotentialDataLoss 错误时,将设置 partial 标志。根据对应Twisted documentation :
This only occurs when making requests to HTTP servers which do not set Content-Length or a Transfer-Encoding in the response
可能的原因包括:
- 服务器配置错误
- 涉及到阻止某些 header 的代理
- 您收到的响应通常没有 Content-Length,例如重定向(301、302、303),但您已设置
handle_httpstatus_list或handle_httpstatus_all,这样响应就不会被 HttpErrorMiddleware 过滤掉或被 RedirectMiddleware 获取
