当前位置:网站首页>scrapy爬虫框架的使用
scrapy爬虫框架的使用
2022-08-01 09:14:00 【liyan_1013】
首先咱们先下载scrapy包
选择Terminal,创建scrapy项目(scrapy startproject 项目名字)
这时候项目创建好了,我们需要修改settings.py文件
20行,ROBOTSTXT_OBEY = False
把65到67的注释取消(原本它是被注释的)
把40到43的注释取消(原本它是被注释的),并在里面添加请求头,
进入spiders目录创建爬虫文件
scrapy genspider 爬虫文件名 域名
咱们爬取课程名称和学习人数
修改start_urls为所要爬取的地址
全选复制,粘贴
找到要爬取所有信息的父标签,并且父标签是唯一的(可以右键,查看网页源代码,Ctrl+f搜索该标签属性是否只有一个)
通过分析,我们所要爬取的信息在ul的li里面
我们利用Xpath获取所有的li标签
遍历il,定位要爬取的内容
边栏推荐
- Idea 常用插件
- pytest接口自动化测试框架 | 跳过测试类
- UXDB如何返回当前数据库所有表的记录数?
- Holoview--Introduction
- Microsoft Azure & NVIDIA IoT developers season I | Azure IoT & NVIDIA Jetson development foundation
- Case practice --- Resnet classic convolutional neural network (Mindspore)
- SAP ABAP ALV+SMARTFORS 表分页 报表打印程序
- PHP获取时间戳后写数据库的一个问题
- SaaS安全认证综合指南
- mysql查看cpu使用情况
猜你喜欢
SAP ABAP ALV+SMARTFORS 表分页 报表打印程序
HoloView 在 jyputer lab/notebook 不显示总结
Get the Token from the revised version of Qubutu Bed
自定义IP在PCIE中使用
net stop/start mysql80 拒绝访问
Microsoft Azure & NVIDIA IoT developers season I | Azure IoT & NVIDIA Jetson development foundation
XX市消防救援指挥中心实战指挥平台多链路聚合解决方案实例
Prime Ring Problem
Leicester Weekly 304 6135. The longest ring in the picture Inward base ring tree
Intensive reading of ACmix papers, and analysis of its model structure
随机推荐
Lsky Pro 企业版手动升级、优化教程
企业数据虚拟化综合指南
network basic learning
Leicester Weekly 304 6135. The longest ring in the picture Inward base ring tree
Get the Token from the revised version of Qubutu Bed
GBase 8s 锁分类
Static Pod, Pod Creation Process, Container Resource Limits
Manual upgrade and optimization tutorial of Lsky Pro Enterprise Edition
codeforces每日5题(均1600)-第二十七天
Go supports OOP: use struct instead of class
centos 安装php7.4,搭建hyperf,转发RDS
常见的API安全缺陷有哪些?
net stop/start mysql80 拒绝访问
报告:想学AI的学生数量已涨200%,老师都不够用了
Delphi MDI appliction 文档最大化显示、去掉最大化最小化等按钮
[Interview: Concurrency 39: Multithreading: Thread Pool] ThreadPoolExecutor Class - Submit, Stop
Delphi MDI appliction documents maximize display, remove buttons such as maximize and minimize
Microsoft Azure & NVIDIA IoT developers season I | Azure IoT & NVIDIA Jetson development foundation
XX市消防救援指挥中心实战指挥平台多链路聚合解决方案实例
HoloView -- Tabular Datasets