会员
众包
新闻
博问
闪存
赞助商
HarmonyOS
Chat2DB
所有博客
当前博客
我的博客
我的园子
账号设置
会员中心
简洁模式
...
退出登录
注册
登录
耗油炒白菜
博客园
首页
新随笔
联系
订阅
管理
上一页
1
2
3
4
5
6
7
8
9
···
27
下一页
2020年8月7日
scrapy-redis实现分布式爬虫
摘要: 一 介绍 原来scrapy的Scheduler维护的是本机的任务队列(存放Request对象及其回调函数等信息)+本机的去重队列(存放访问过的url地址) 所以实现分布式爬取的关键就是,找一台专门的主机上运行一个共享的队列比如Redis,然后重写Scrapy的Scheduler,让新的Schedul
阅读全文
posted @ 2020-08-07 00:23 耗油炒白菜
阅读(165)
评论(0)
推荐(0)
2020年8月6日
scrapy的去重规则
摘要: scrapy自带去重策略: 参考:https://www.cnblogs.com/liuqingzheng/p/16005880.html 配置文件: DUPEFILTER_CLASS = 'scrapy.dupefilters.RFPDupeFilter' # 默认的去重规则帮我们去重,去重规则在
阅读全文
posted @ 2020-08-06 23:17 耗油炒白菜
阅读(471)
评论(0)
推荐(0)
scrapy中下载中间件异常处理
摘要: 示例: def process_exception(self, request, exception, spider): # Called when a download handler or a process_request() # (from other downloader middlewa
阅读全文
posted @ 2020-08-06 22:25 耗油炒白菜
阅读(530)
评论(0)
推荐(0)
selenium在scrapy中的使用流程
摘要: # 当前爬虫用的selenium是同一个 1、在爬虫中初始化webdriver对象 import scrapy from selenium import webdriver class CnblogSpider(scrapy.Spider): name = 'cnblog' allowed_doma
阅读全文
posted @ 2020-08-06 22:19 耗油炒白菜
阅读(200)
评论(0)
推荐(0)
scrapy的中间件(下载中间件)
摘要: middleware.py # 下载中间件 # middlewares.py -process_request:返回不同的对象,后续处理不同(加代理...) class CnblogsDownloaderMiddleware: @classmethod def from_crawler(cls, c
阅读全文
posted @ 2020-08-06 22:14 耗油炒白菜
阅读(94)
评论(0)
推荐(0)
提升scrapy爬取数据的效率
摘要: 方法: - 在配置文件中进行相关的配置即可:(默认还有一套setting) #1 增加并发: 默认scrapy开启的并发线程为32个,可以适当进行增加。在settings配置文件中修改CONCURRENT_REQUESTS = 100值为100,并发设置成了为100。 #2 降低日志级别: 在运行s
阅读全文
posted @ 2020-08-06 20:25 耗油炒白菜
阅读(142)
评论(0)
推荐(0)
2020年8月5日
scrapy直接取出文章所有内容
摘要: 示例: import scrapy from firstscrapy.items import CnblogsMysqlItem class CnblogsSpider(scrapy.Spider): name = 'cnblogs' allowed_domains = ['www.cnblogs.
阅读全文
posted @ 2020-08-05 23:42 耗油炒白菜
阅读(117)
评论(0)
推荐(0)
scrapy练习
摘要: 1、爬取cnblogs首页文章,打印出标题和连接地址 spiders/cnblogs.py import scrapy class CnblogsSpider(scrapy.Spider): name = 'cnblogs' allowed_domains = ['www.cnblogs.com']
阅读全文
posted @ 2020-08-05 19:53 耗油炒白菜
阅读(227)
评论(0)
推荐(0)
爬虫之Scrapy框架
摘要: 一 介绍(爬虫界的django) Scrapy一个开源和协作的框架,其最初是为了页面抓取 (更确切来说, 网络抓取 )所设计的,使用它可以以快速、简单、可扩展的方式从网站中提取所需的数据。但目前Scrapy的用途十分广泛,可用于如数据挖掘、监测和自动化测试等领域,也可以应用在获取API所返回的数据(
阅读全文
posted @ 2020-08-05 14:40 耗油炒白菜
阅读(277)
评论(0)
推荐(0)
selenium练习
摘要: 爬取豆瓣top250电影:https://movie.douban.com/top250 from selenium import webdriver import time bro = webdriver.Chrome(executable_path='./chromedriver.exe') #
阅读全文
posted @ 2020-08-05 00:40 耗油炒白菜
阅读(113)
评论(0)
推荐(0)
上一页
1
2
3
4
5
6
7
8
9
···
27
下一页
公告