一个简单的网络爬行框架。
simple-spiders的Python项目详细描述
_ _ _____ _ _ (_) | | / ____| (_) | | ___ _ _ __ ___ _ __ | | ___ | (___ _ __ _ __| | ___ _ __ / __| | '_ ` _ \| '_ \| |/ _ \ \___ \| '_ \| |/ _` |/ _ \ '__| \__ \ | | | | | | |_) | | __/ ____) | |_) | | (_| | __/ | |___/_|_| |_| |_| .__/|_|\___| |_____/| .__/|_|\__,_|\___|_| | | | | |_| |_|
概述
简单的网络爬行 框架。Document
开始
pip install simple-spiders
您应该构造project.py以满足您的需要
from crawler.spider import Spider from crawler.writter import DataWriter spider = Spider( 'https://movie.douban.com/subject/26810318/comments?start=0&limit=20&sort=new_score&status=P') spider.start_crawl()
python project.py
Ctrl-C to stop
参考库
- 使用requests作为 htmldownloader
- 使用lxml作为默认htmlparser
- 使用csv提供导出的功能 文件为CSV类型
- 使用xlwt提供 将文件导出为excel类型
- 使用xlsxwriter提供 将文件导出为Xexcel类型的功能
用法
项目结构
- crawler/ - __init__.py - test/ - htmlDownloder_test - htmlParser_test - requestManager_test - writter_test - logger_test - spider_test - htmlDownloder - htmlParser - requestManager - writter - logger - spider - main.py