scrapy的selectors
来源:互联网 发布:淘宝首页装修 编辑:程序博客网 时间:2024/06/04 19:42
选择器
Scrapy selector是以 文字(text) 或 TextResponse 构造的 Selector 实例。 其根据输入的类型自动选择最优的分析方法(XML vs HTML):
from scrapy.selector import Selectorfrom scrapy.http import HtmlResponse#文字选择器构造body = '<html><body><span>good</span></body></html>'Selector(text=body).xpath('//span/text()').extract()[u'good']#response构造response = HtmlResponse(url='http://example.com',body=body)Selector(response=response).xpath('//span/text()').extract()response.selector.xpath()才是真正的方法
xpath() #根据xapth方法
css() #根据css选择器
re() #根据正则
extract() #将结果串行化到一个列表
官方文档
中文官方文档
官方文档是学习的最好资料
0 0
- scrapy的selectors
- scrapy爬虫之selectors
- 三分钟学会Scrapy选择器(selectors)
- Scrapy爬虫入门教程五 Selectors(选择器)
- Scrapy学习笔记(5)--Selectors 选择器
- 爬虫Scrapy-03Shell和Selectors
- python3 scrapy css选择器(Selectors) 用法
- selectors
- Selectors
- Scrapy 小技巧:选择器(Selectors)怎么写
- JQuery的部分常见Selectors
- jQuery-Selectors(选择器)的使用
- Java的NIO之Selectors的使用
- CSS的选择符(selectors)
- Dust-Me selectors 清理你的CSS
- 【scrapy】scrapy的环境依赖
- jQuery-Selectors(选择器)的使用(六、属性篇)
- jQuery-Selectors(选择器)的使用(一、基本篇)
- vue-cli 环境搭建
- 如何通过命令将本地项目代码上传到github
- oracle中global_name的相关信息
- java 线程中的 wait()和sleep()
- spring ioc原理
- scrapy的selectors
- linux上查找文件存放地点和文件中查找字符串方法
- Shell判断
- (九)ReactNative IDE VSCode插件
- VMWARE里启动kylin16.0时出现'SMBus Host Controller not enabled'(还未进入系统)
- mysql select查询语句优化方案
- 如何判断自己是更适合技术岗位还是更适合销售类的岗位。
- 贪心算法和动态规划区别
- Unity自定义UI组件(一)函数图篇(上)