Scrapy+crontab 定时爬取小说更新推送到手机邮件
本人酷爱追火星引力的《逆天邪神》小说,但经常是俩三天才一更,每天打开浏览器查看是否更新贼痛苦。现在利用所学的知识来解决问题。文章分三部分:一、爬取更新 二、发送邮件 三、定时任务。爬虫内容简单,适合scrapy新手,重点在于发送邮件和定时任务。
一、爬取更新
小说地址:http://m.zongheng.com/h5/book?bookid=408586
页面图片:
1.创建工程project
选择一个目录:/home/yunge/code/spiders/
执行命令:
scrapy startproject xiaoshuo
2.创建spider
进入工程内,执行命令:
cd /xiaoshuo/xiaoshuo
创建spider,执行命令:
scrapy genspider nitianspider zongheng.com
3.items.py 填空
import scrapy
class XiaoshuoItem(scrapy.Item):
# define the fields for your item here like: