当前位置:网站首页>Use the scrapy to climb to save data to mysql to prevent repetition
Use the scrapy to climb to save data to mysql to prevent repetition
2022-08-02 09:21:00 【51CTO】
1.环境建立
1.使用xmapp安装php, mysql ,phpmyadmin
2.安装python3,pip
3.安装pymysql
3.(windows 略)我这边是mac,安装brew,用brew 安装scrapy
2.整个流程
1. 创建数据库和数据库表,准备保存
2.write crawler targetURL,进行网络请求
3.Process the crawl return data,得到具体数据
4.For specific data saved to the database
2.1.创建数据库
First create a database called scrapy,然后创建一个表article,我们这里给body加了唯一索引,防止重复插入数据
It's like this after it's done.
2.2 Let's first look at the structure of the entire crawler project
quotes_spider.py是核心,Responsible for processing network requests and content,Then throw the sorted contentpipelines进行具体处理,保存到数据库中,This will not affect the speed.
其他的看 图说明
2.2 write crawler targetURL,进行网络请求
start_requests Is to write the specific to climbURL
parseIt is the core where the returned data is processed,然后以item的形式抛出,Next, define the next content to crawl
2.3 items
2.4 pipelines
2.5 配置
边栏推荐
- Pycharm (1) the basic use of tutorial
- 裁员趋势下的大厂面试:“字节跳动”
- Golang ORM框架 — GORM
- RestTemlate源码分析及工具类设计
- Nodejs3day(express简介,express创建基本Web服务器,托管静态资源,nodemon下载及出现的问题,中间件,编写GET,POST,JSONP接口)
- 【Redis】通用命令
- Worship, Alibaba distributed system development and core principle analysis manual
- 曲折的tensorflow安装过程(Tensorflow 安装问题的解决)
- AutoJs学习-实现科赫雪花
- 边缘计算开源项目概述
猜你喜欢
随机推荐
mysql连接池的实现
PyCharm usage tutorial (detailed version - graphic and text combination)
EdrawMax Crack,多合一的图表应用程序
中国发布丨滴滴因违反网络安全法等被罚80.26亿元!调查细节公布
不用Swagger,那我用啥?
How to use postman
二分类和多分类
查看变量的数据格式
使用scrapy 把爬到的数据保存到mysql 防止重复
LeetCode第三题(Longest Substring Without Repeating Characters)三部曲之一:解题思路
【微信小程序2】事件绑定
软件exe图标变记事本或浏览器、360压缩打不开的几种应急解决方法
UVM事务级建模
day_05模块
spark:页面单跳转换率统计(案例)
Pycharm (1) the basic use of tutorial
cococreator 动态设置精灵
在 QT Creator 上配置 opencv 环境的一些认识和注意点
HCIA动态主机配置协议实验(dhcp)
PyQt5安装配置(PyCharm) 亲测可用