本文将介绍如何将抓好的item数据存入到mysql中
声明:本文使用的python交互工具为pymysql并非mysqldb,因为网上使用pymysql存入数据的相关文章较少,所以写了这篇文章供大家参考
环境:ubantu
准备工作:
items.py
将想要抓的数据累出来,下面是我要抓的数据:(我的项目名为wens)
class WensItem(scrapy.Item):
# define the fields for your item here like:
# name = scrapy.Field()
img_url = scrapy.Field()
name = scrapy.Field()
update_time = scrapy.Field()
update_word = scrapy.Field()
author = scrapy.Field()
steam.py(我的爬虫脚本)
当然也别忘了引入

该文详细介绍了如何利用Scrapy框架配合pymysql库,将爬取到的item数据有效存储到MySQL数据库中,特别强调了在ubantu环境下进行的操作,包括items.py的定义、pipelines.py的配置和设置。
&spm=1001.2101.3001.5002&articleId=78613465&d=1&t=3&u=8fd32fec330d432eaa90d7fb904ac33f)
2390

被折叠的 条评论
为什么被折叠?



