An essential component in all of our projects.
It may or may not come as a surprise that we, as the founding authors and maintainers of Scrapy, use the foundational Open Source web scraping framework to assist with our managed web data extraction projects.
The framework, first developed by Zyte co-founders Pablo Hoffman and Zyte co-founder and CEO Shane Evans in 2008, has since become the most widely used web scraping framework in the world.
Scrapy is a pivotal part of our web scraping stack, and we use it all the time to collect web data for some of the largest companies in the world, and as power users, we wanted to share some of the plugins we employ every day. Here are four essential Scrapy plugins that we use all the time to build efficient web crawlers for our customers.
1. Scrapy Time Machine
Scrapy Time Machine is a plugin that allows developers to "go back in time" when scraping websites. It achieves this by letting the scraper simulate requests with past dates, which can be particularly useful for testing how a website responds to requests at different times or for scraping historical data. The plugin is valuable when dealing with time-sensitive data or websites that show different content based on the date of access.
2. Scrapy Settings Log
Scrapy Settings Log is a plugin designed to log all settings used by a Scrapy project. When you start a Scrapy spider, it logs the configuration settings, providing a clear record of what settings were active during the crawl. This is especially useful for debugging and for ensuring that your scraper behaves consistently across different runs by making it easier to reproduce results.
3. Scrapy JSONSchema
Scrapy JSONSchema is a plugin that enables validation of scraped data against a predefined JSON schema. Developers can define the structure, data types, and required fields that the scraped data should conform to. The plugin then automatically validates the data as it is scraped, ensuring that the output meets the expected format and catches errors early in the scraping process.
4. Scrapy Sticky Meta Params
Scrapy Sticky Meta Params is a plugin that allows developers to preserve certain metadata (meta parameters) across requests within a Scrapy spider. Normally, meta data is passed from one request to the next, but it can be easy to lose or accidentally overwrite this data in complex spiders. This plugin ensures that specified meta parameters remain "sticky" and are consistently carried over, simplifying the management of state across multiple requests.
These plugins extend Scrapy’s functionality and provide tools for more specialized use cases, enhancing the robustness and flexibility of web scraping projects.
Helpful Scrapy Resources
Overview of the web scraping ecosystem for professional developers
Need some added horsepower? Try Zyte API.
Scrapy-zyte-api: the plugin we use to activate Zyte API for Scrapy projects
scrapy-poet: build a single spider that supports many sites with different layouts