吉阿吉

2021年5月3日

docker分布式爬虫搭建

摘要: 一、基础镜像 参考《精通Python网络爬虫》机械工业出版社 二、实现中心节点并配置Redis与MySql docker run -tid --name ceter c354 #创建中心节点 docker ps -a #查看详情 docker attch 2eaf #进入中心节点 cat /etc/ 阅读全文

posted @ 2021-05-03 16:38 吉阿吉 阅读(103) 评论(0) 推荐(0) 编辑

scrapy各管道存储模板

摘要: 一、csv文件存储 class CsvPipeline(): def open_spider(self,spider): self.file=open('filename.csv','wb') self.csv_exporter=CsvItemExporter(self.file) self.csv 阅读全文

posted @ 2021-05-03 15:52 吉阿吉 阅读(69) 评论(0) 推荐(0) 编辑

2021年5月2日

分布式爬虫处理redis数据

摘要: 分布式爬虫默认八数据存储在redis中,可以将数据转存到Monogdb或Mysql中,从而降低内存消耗。 from redis import Redisfrom pymongo import MongoClientimport jsondef redis_to_mongodb(): redis_cl 阅读全文

posted @ 2021-05-02 23:53 吉阿吉 阅读(86) 评论(0) 推荐(0) 编辑

豆瓣电影爬虫

摘要: 一、分析 阅读全文

posted @ 2021-05-02 23:18 吉阿吉 阅读(34) 评论(0) 推荐(0) 编辑

redis命令

摘要: redis-cli quit set setnx setex mset get incr append 阅读全文

posted @ 2021-05-02 15:34 吉阿吉 阅读(18) 评论(0) 推荐(0) 编辑

2021年5月1日

主从分布式5i5j爬虫

摘要: 一、实现单机scrapy爬虫 阅读全文

posted @ 2021-05-01 14:56 吉阿吉 阅读(83) 评论(0) 推荐(0) 编辑

2021年4月30日

scrapy 传递参数meta用法

摘要: 场景:一个标题A,上面有一个链接B,链接B里面有内容C,如果要把标题A和内容C一一对应的话,在scrapy里面用meta就比较容易实现啦。 class File01Spider(scrapy.Spider): name = 'file01' start_urls = ['http://www.jkl 阅读全文

posted @ 2021-04-30 13:55 吉阿吉 阅读(639) 评论(0) 推荐(0) 编辑

2021年4月28日

scrapy_redis分布式爬虫

摘要: 一、原生态的scrapy不支持分布式,因为调度器和管道无法共享。 阅读全文

posted @ 2021-04-28 20:36 吉阿吉 阅读(32) 评论(0) 推荐(0) 编辑

2021年4月27日

豆瓣图书信息爬虫

摘要: 一、定义数据库数据模型 create database doubandb; create TABLE books( id bigint(20) unsigned NOT NULL COMMENT ID号, title varchar(255) DEFAULT NULL COMMENT 书名, aut 阅读全文

posted @ 2021-04-27 16:15 吉阿吉 阅读(180) 评论(0) 推荐(0) 编辑

百度失信人名单爬虫

摘要: 一、item.py中定义数据模型 class Dishonest(scrapy.Item): name=scrapy.Field() card_num=scrapy.Field() age=scrapy.Field() area=scrapy.Field() business_entiy=scrap 阅读全文

posted @ 2021-04-27 13:55 吉阿吉 阅读(137) 评论(0) 推荐(0) 编辑

导航