Skip to main content

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

https://github.com/kanadeblisst/scrapy_redis_bf

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.2.tar.gz (6.3 kB view details)

Uploaded Source

Built Distribution

scrapy_redis_bf-0.1.2-py3-none-any.whl (7.5 kB view details)

Uploaded Python 3

File details

Details for the file scrapy_redis_bf-0.1.2.tar.gz.

File metadata

  • Download URL: scrapy_redis_bf-0.1.2.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

Hashes for scrapy_redis_bf-0.1.2.tar.gz
Algorithm Hash digest
SHA256 36ff938f7378195fadeff7f4fb4e19caff7cc9f39fc1a1a30593b0d7822d682c
MD5 984c4aa20a9a0db861604c0cbcf34d9c
BLAKE2b-256 ebbd9803bdaf6865d6a5cfd3fcc0690148bfff0d06dd9cdcd6de1f496983a77f

See more details on using hashes here.

File details

Details for the file scrapy_redis_bf-0.1.2-py3-none-any.whl.

File metadata

File hashes

Hashes for scrapy_redis_bf-0.1.2-py3-none-any.whl
Algorithm Hash digest
SHA256 de56aea8da64a955c03303b3f5fc468823724a1a2eedc92b75706e42b09188ea
MD5 a4d220e3f7b70750f29e7fd36c2ef9e4
BLAKE2b-256 01d544b7e6cf67c2c140ee17330343caa4751bbb39be36fb31afcb8ca9e96589

See more details on using hashes here.

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page