Generated by GPT-5-mini| Scrapy | |
|---|---|
| Name | Scrapy |
| Developers | Scrapinghub, Zyte, Collin Duggan |
| Initial release | 2008 |
| Programming language | Python |
| License | BSD |
| Website | https://scrapy.org |
Scrapy is an open-source web crawling and web scraping framework written in Python, designed for extracting structured data from websites and APIs. It provides tools for defining spiders, handling requests and responses, parsing HTML and XML, and exporting data in multiple formats, enabling integration with systems like Apache Kafka, PostgreSQL, MongoDB, Elasticsearch, Redis and platforms such as Amazon Web Services, Google Cloud Platform and Microsoft Azure. Scrapy is widely used in research and industry by organizations including Netflix, Instagram, Bloomberg, The New York Times, and Zyte.
Scrapy offers a programmatic framework for building crawlers and scrapers that interact with web resources similar to frameworks used by Django, Flask, Tornado, FastAPI for web development. It leverages parsing libraries such as lxml, Beautiful Soup and html5lib and can be extended with parsers from projects like parsel and PyQuery. Users integrate Scrapy with data processing tools including Pandas, NumPy, Apache Spark, Dask and Hadoop for downstream analytics, or with message brokers like RabbitMQ and ZeroMQ for distributed workflows.
Scrapy originated in 2008, developed by a team at Mydeco and later maintained by Scrapinghub (now Zyte). Key contributors include engineers affiliated with projects like Twisted, Requests, SQLAlchemy, Celery and pytest. The project evolved alongside initiatives such as Open Data Institute, W3C recommendations, and web harvesting programs at institutions like Stanford University and MIT. Major milestones intersect with releases in the Python ecosystem alongside versions of CPython, PEP 8 adoption, and packaging improvements via pip and setuptools.
Scrapy's architecture uses an asynchronous event-driven model influenced by Twisted and integrates with networking stacks similar to urllib3 and httplib2. Core components include the Scheduler, Downloader, Engine, Item Pipeline, and Spiders, analogous to components in frameworks like Apache Nutch and Heritrix. For storage and indexing, users pair Scrapy with Solr, Elasticsearch, Cassandra or ClickHouse. Monitoring and orchestration integrate with systems such as Prometheus, Grafana, Kubernetes, Docker Swarm and Nomad.
Spiders define crawling behavior similar to bots developed for Common Crawl datasets or crawlers referenced in research from University of California, Berkeley and Carnegie Mellon University. Parsing uses selectors akin to XPath and CSS, employing libraries like lxml and parsel. Data output formats include JSON, CSV, and XML, interoperable with tools like Tableau, Power BI and Jupyter Notebook. Typical workflows connect Scrapy spiders to task queues such as Celery or orchestration systems like Airflow and Prefect for scheduled extraction and ETL pipelines.
Scrapy supports middlewares and extensions to modify request/response processing, comparable to middleware patterns in Express.js and Spring Framework. Common extensions include integration with Selenium for JavaScript rendering, headless browsers like Headless Chrome and Playwright, and proxy services comparable to Bright Data and Oxylabs. For authentication and API interactions, Scrapy works alongside OAuth providers like Google OAuth 2.0, Facebook Login and Twitter API, and identity systems such as Auth0 and Okta.
Deployment strategies for Scrapy often utilize containerization via Docker and orchestration on Kubernetes with CI/CD pipelines involving Jenkins, GitHub Actions, GitLab CI/CD or CircleCI. For horizontal scaling, teams combine Scrapy with distributed schedulers or brokers like Apache Kafka, Redis and RabbitMQ, and storage backends such as Amazon S3, Azure Blob Storage and Google Cloud Storage. Large-scale crawling projects draw on practices from Common Crawl, research efforts at Yahoo! Research and production deployments at companies like Facebook and LinkedIn.
Operating Scrapy at scale intersects with legal and ethical frameworks including policies defined by European Union regulations such as GDPR and guidance from organizations like the Internet Archive and Electronic Frontier Foundation. Best practices include honoring robots.txt directives, respecting terms of service used by sites such as Wikipedia, Twitter, Amazon and eBay, and implementing rate limiting analogous to techniques in Rate limiting studies by IETF. Security measures engage with threat models discussed by OWASP, use TLS implementations from OpenSSL, and follow responsible disclosure pathways used by projects hosted on GitHub and GitLab.
Category:Web scraping