Skip to main content

An asyncio-style web scraping framework inspired by Scrapy, powered by curl_cffi.

Project description

scrapy_cffi

An asyncio-style web scraping framework inspired by Scrapy, powered by curl_cffi.

scrapy_cffi is a lightweight Python crawler framework that mimics the Scrapy architecture while replacing Twisted with curl_cffi as the underlying HTTP/WebSocket client.

It is designed to be efficient, modular, and suitable for both simple tasks and large-scale distributed crawlers.


✨ Features

  • Scrapy-style architecture: spiders, items, interceptors, pipelines, signals

  • Fully asyncio-based engine for maximum concurrency

  • HTTP & WebSocket support: built-in asynchronous clients

  • Flexible DB integration: Redis, MySQL, MongoDB with async retry & reconnect

  • Message queue support: RabbitMQ & Kafka

  • Configurable deployment: settings system supporting .env files, single-instance, cluster mode, and sentinel mode

  • Lightweight middleware & interceptor system for easy extensions

  • High-performance C-extension hooks for CPU-intensive tasks

  • Redis-compatible scheduler (optional) for distributed crawling

  • Designed for high-concurrency, high-availability crawling


📦 Installation

From PyPI

pip install scrapy_cffi

From source (unstable)

git clone https://github.com/aFunnyStrange/scrapy_cffi.git

cd scrapy_cffi

pip install -e .

🚀 Quick Start

scrapy-cffi startproject <project_name>

cd <project_name>

scrapy-cffi genspider <spider_name> <domain>

python runner.py

Notes:

The CLI command is scrapy_cffi in versions ≤0.1.4 and scrapy-cffi in versions >0.1.4 for improved usability.


⚙️ Settings & Deployment

scrapy_cffi now fully supports a flexible settings system:

  • Load configuration from Python files or .env files

  • Choose between single-instance, cluster, or sentinel mode

  • Configure databases, message queues, and concurrency limits in one place

  • Seamless integration with async Redis/MySQL/MongoDB managers

Example settings.py snippet:

settings.REDIS_INFO.MODE = "sentinel"

settings.REDIS_INFO.SENTINELS = [("<master_host1>", "int(master_port1)"), ("<master_host2>", "int(master_port2)"), ("<master_host3>", "int(master_port3)")]

settings.REDIS_INFO.MASTER_NAME = "<master_name>"

settings.REDIS_INFO.SENTINEL_OVERRIDE_MASTER = ("master_host", "int(master_port)")

📖 Documentation

Full technical documentation and module-level guides are available in the docs/ directory.


📄 License

BSD 3-Clause License. See LICENSE for details.


🛠 Community Highlights

Inspired by the challenges of async Python crawling:

  • Blocking requests and slow DB integration

  • Complex deployment for distributed crawlers

  • Need for fully concurrent HTTP & WebSocket requests

scrapy_cffi addresses these with a modular, high-performance framework that is async-first, extensible, and deployment-ready.

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_cffi-0.2.4.tar.gz (104.0 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

scrapy_cffi-0.2.4-py3-none-any.whl (143.1 kB view details)

Uploaded Python 3

File details

Details for the file scrapy_cffi-0.2.4.tar.gz.

File metadata

  • Download URL: scrapy_cffi-0.2.4.tar.gz
  • Upload date:
  • Size: 104.0 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.11.14

File hashes

Hashes for scrapy_cffi-0.2.4.tar.gz
Algorithm Hash digest
SHA256 8b820de069c2ab8a1fa95ee7885b9236680c9d80396119e5440ec4f6a45b3c41
MD5 83334d9549f2fadc7f56647355f1bb14
BLAKE2b-256 7d19e24cb6122bd3ec5e616d7b6a0ab54278592e174d4ae2603fa91e7d33c94b

See more details on using hashes here.

File details

Details for the file scrapy_cffi-0.2.4-py3-none-any.whl.

File metadata

  • Download URL: scrapy_cffi-0.2.4-py3-none-any.whl
  • Upload date:
  • Size: 143.1 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.11.14

File hashes

Hashes for scrapy_cffi-0.2.4-py3-none-any.whl
Algorithm Hash digest
SHA256 4855bb5fdd6dda7f6e39014866e78de90dd96536a3a494486b4c804359686e63
MD5 08955b16171329e1609ee0ef878a402a
BLAKE2b-256 5e6259c61c22510eb0c5bbd85191c40f6777711877ae64f00dfbe155fdd30497

See more details on using hashes here.

Supported by

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