scrapy_redis use bloomfilter
Project description
Scrapy-Redis-BloomFilter
这是个scrapy_redis的布隆过滤器版本,与https://github.com/Python3WebSpider/ScrapyRedisBloomFilter
不同的是,该项目使用redis里的布隆过滤器,而不是使用bit来实现
必要条件
需要redis加载了布隆过滤器的插件,默认安装的redis是没有加载的 具体请看:https://redis.io/docs/stack/bloom/quick_start/
安装
使用pip: pip install scrapy-redis-bf
使用
在scrapy项目里的 settings.py
添加如下设置:
SCHEDULER = "scrapy_redis_bf.scheduler.Scheduler"
DUPEFILTER_CLASS = "scrapy_redis_bf.dupefilter.RFPDupeFilter"
# 默认是通过spider的name来创建redis key
SCHEDULER_DUPEFILTER_ATTR = "name"
# 格式:redis://[:password@]host[:port][/database][?[timeout=timeout[d|h|m|s|ms|us|ns]][&database=database]]
REDIS_URL = 'redis://localhost:6379'
# 错误率
BLOOMFILTER_ERRORRATE = 0.001
# 去重量
BLOOMFILTER_CAPACITY = 10000
测试
下载该项目,然后运行里面的test spider即可
Github
Project details
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
scrapy_redis_bf-0.1.1.tar.gz
(6.3 kB
view details)
Built Distribution
File details
Details for the file scrapy_redis_bf-0.1.1.tar.gz
.
File metadata
- Download URL: scrapy_redis_bf-0.1.1.tar.gz
- Upload date:
- Size: 6.3 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/4.0.1 CPython/3.9.13
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | bea73fe5abce066814439aa3db27cfeb96caf2c939f597d837e7220e67b43017 |
|
MD5 | cad22769f8dcdf125d8290cbb02f172d |
|
BLAKE2b-256 | 2e8e507a25a8303635826f2419720e131f6b5729490dbc201403de8d1aed5117 |
File details
Details for the file scrapy_redis_bf-0.1.1-py3-none-any.whl
.
File metadata
- Download URL: scrapy_redis_bf-0.1.1-py3-none-any.whl
- Upload date:
- Size: 7.4 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/4.0.1 CPython/3.9.13
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | b7ab9a734ffd4b6d0926cd5b6064f3597b51da15710f1823720a23edb5101606 |
|
MD5 | 08b129c852b68b4cec95edb452d02118 |
|
BLAKE2b-256 | 83a45468eee15adc116fcf79c648aaacf26e3753d07a4b24fbe53865dd72d44e |