python - 提炼用 Scrapy
问题描述
如何<header></header>
使用 Scrapy 从页面中提取所有内容?我试过这个,但无济于事:response.css('header')
另外,我需要<img></img>
自己<header></header>
分析class
内容和src
链接。
解决方案
您可以使用 XPath:
response.xpath('//header')
对于图像:
response.xpath('//header//img') # This assumes there are img tags somewhere inside header
添加@class
到选择器,使其返回类值和@src
src 值。
推荐阅读
- python - 现在是一个月的哪一周?
- python - Pandas json_normalize 将值作为列的字典展平
- reactjs - dashbio Circos / D3 和弦图上的响应式大小
- java - PDF Box - 添加标题时出错
- javascript - 调用 JavaScript 函数时出现语法错误
- swift - SwiftUI 测量每个视图的创建时间
- azure - 导出调用后查询副本状态 - fhir azure
- acumatica - soapClient.GetList 不返回在 Acumatica I300 课程中创建的 CustomFields
- javascript - 为什么我们将 Vue 实例保存在变量或常量中?
- firefox - 如何检查 Firefox 中动态创建的 bootstrap4 元素?