Scrapy-Redis-CuckooFilter
这是个scrapy_redis的布谷鸟过滤器版本,项目和 https://github.com/kanadeblisst/scrapy_redis_bf 基本一样
必要条件
需要redis加载了布隆过滤器的插件,默认安装的redis是没有加载的 具体请看:https://redis.io/docs/stack/bloom/quick_start/
安装
使用pip: pip install scrapy-redis-cf
使用
在scrapy项目里的 settings.py添加如下设置:
SCHEDULER = "scrapy_redis_cf.scheduler.Scheduler"
DUPEFILTER_CLASS = "scrapy_redis_cf.dupefilter.RFPDupeFilter"
# 格式:redis://[:password@]host[:port][/database][?[timeout=timeout[d|h|m|s|ms|us|ns]][&database=database]]
REDIS_URL = 'redis://localhost:6379'
# 桶的大小,桶越大错误率越高, 但过滤器填充率越高
# 等于1时错误率最小为0.78%,等于3时为2.35%, 等于2时官网没说我也不知道
# https://redis.io/commands/cf.reserve/
CUCKOOFILTER_BUCKETSIZE = 2
# 去重数量 2 ** 18 ,
# 注意:实际容量要小于这个,因为布谷鸟过滤器很难完全填满
CUCKOOFILTER_CAPACITY_BIT = 18
# 支持扩展容量的次数, 扩展次数越多,错误率越高
CUCKOOFILLTER_EXPANSION = 2
测试
下载该项目,然后运行里面的test spider即可
Github
Metadata
Release files for scrapy-redis-cf 0.0.1
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | Provenance | Actions |
|---|---|---|---|---|
| scrapy_redis_cf-0.0.1.tar.gz | 5.2 kB | Without provenance | Details for scrapy_redis_cf-0.0.1.tar.gz |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Actions Reset |
|---|---|---|---|---|
| scrapy_redis_cf-0.0.1-py3-none-any.whl | Python 3 | none | any | Details for scrapy_redis_cf-0.0.1-py3-none-any.whl |
Total release size: 11.8 kB
Release files / scrapy_redis_cf-0.0.1.tar.gz
| Download URL | scrapy_redis_cf-0.0.1.tar.gz |
|---|---|
| Size | 5.2 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
9903fdc8316c26563a0b5db849e36c327673226d8026159250877a6def389433
|
|
BLAKE2b-256 checksum How to use checksums |
f3b7d67f624846c539b3ac0440f86dbe1927e3aeded505aeab1620821f76bf9a
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/4.0.1 CPython/3.8.13
|
Release files / scrapy_redis_cf-0.0.1-py3-none-any.whl
| Download URL | scrapy_redis_cf-0.0.1-py3-none-any.whl |
|---|---|
| Size | 6.6 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
ff47b22759130a2478a665ad8cc0e55fa4bbbbb7e229fef0e4d8c73ca3f5d3a5
|
|
BLAKE2b-256 checksum How to use checksums |
63ce6970a618ed105ad22e28039b93de8ba63e317ebc6d01c1278adaa474b1be
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/4.0.1 CPython/3.8.13
|
Security for scrapy-redis-cf 0.0.1
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
No provenance found
None of the files in this release were uploaded with provenance metadata.
A note on package security
PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.
To learn more about protecting yourself from malicious actors, visit our package security documentation.