大文件下载:大文件数据是在管道中请求到的
- 下属管道类是 scrap封装好的我们直接用即可
- from scrap pipelines. images import Imagespipeline
- 重写该管道类的三个方法:
- get_media_requests
- 对图片地址发起请求
- get_media_requests
- file_path
- 返回图片名称即可
- item_completed
- 返回item,将其返回给下一个即将被执行的
管道类在配置文件中添加:
- IMAGES STORE = dirname
代码地址
https://gitee.com/sdm89/ImgScrapy
运行命令:
pip install -r piplist.txt # 安装相关包文件
scrapy crawl imgpicture --nolog