Scrapy 2.20 documentation
Scrapy is a fast high-level web crawling and web scraping framework, used to crawl websites and extract structured data from their pages. It can be used for a wide range of purposes, from data mining to monitoring and automated testing.
Getting help
Having trouble? Read the FAQ, ask a question in GitHub Discussions or report a bug on our issue tracker. See Getting help for more options.
First steps
- Scrapy at a glance
Understand what Scrapy is and how it can help you.
- Installation guide
Get Scrapy installed on your computer.
- Scrapy Tutorial
Write your first Scrapy project.
- Examples
Learn more by playing with a pre-made Scrapy project.
- Getting help
Find support beyond this documentation.
Basic concepts
- Scrapy’s building blocks
Get a quick map of Scrapy’s main concepts and when to use each.
- Command line tool
Learn about the command-line tool used to manage your Scrapy project.
- Spiders
Write the rules to crawl your websites.
- Selectors
Extract the data from web pages using XPath.
- Items
Define the data you want to scrape.
- Item Loaders
Populate your items with the extracted data.
- Scrapy shell
Test your extraction code in an interactive environment.
- Item Pipeline
Post-process and store your scraped data.
- Feed exports
Output your scraped data using different formats and storages.
- Requests and Responses
Understand the classes used to represent HTTP requests and responses.
- Cookies
Send and receive cookies.
- Link Extractors
Convenient classes to extract links to follow from pages.
- Settings
Learn how to configure Scrapy and see all available settings.
- Exceptions
See all available exceptions and their meaning.
Built-in services
- Logging
Learn how to use Python’s built-in logging in Scrapy.
- Stats Collection
Collect statistics about your scraping crawler.
- Telnet Console
Inspect a running crawler using a built-in Python console.
Solving specific problems
- Frequently Asked Questions
Get answers to most frequently asked questions.
- Using Scrapy with coding agents
Learn how to use Scrapy with coding agents efficiently.
- Using your browser’s Developer Tools for scraping
Learn how to scrape with your browser’s developer tools.
- Extracting clean content and values
Get the content of a page as clean text or markdown, and turn the strings you select into values.
- Selecting dynamically-loaded content
Read webpage data that is loaded dynamically.
- Downloading and processing files and images
Download files and/or images associated with your scraped items.
- Debugging Spiders
Learn how to debug common problems of your Scrapy spider.
- Spider Contracts
Learn how to use contracts for testing your spiders.
- Common Practices
Get familiar with some Scrapy common practices.
- AutoThrottle extension
Adjust crawl rate dynamically based on load.
- Security
Understand the security implications of Scrapy defaults and how to harden them.
- Jobs: pausing and resuming crawls
Learn how to pause and resume crawls for large spiders.
- Deploying Spiders
Deploy your Scrapy spiders and run them on a remote server.
- Optimization
Find the bottleneck of your crawls and learn how to address it.
- Benchmarking
Check how Scrapy performs on your hardware.
- Debugging memory leaks
Learn how to find and get rid of memory leaks in your crawler.
- Coroutines
Use the coroutine syntax.
- asyncio
Extending Scrapy
- Architecture overview
Understand the Scrapy architecture.
- Add-ons
Enable and configure third-party extensions.
- Downloader Middleware
Customize how pages get requested and downloaded.
- Spider Middleware
Customize the input and output of your spiders.
- Extensions
Extend Scrapy with your custom functionality.
- Signals
See all available signals and how to work with them.
- Scheduler
Understand the scheduler component.
- Item Exporters
Quickly export your scraped items to a file (XML, CSV, etc.).
- Download handlers
Customize how requests are downloaded or add support for new URL schemes.
- Components
Learn the common API and some good practices when building custom Scrapy components.
- Core API
Use it in extensions and middlewares to extend Scrapy functionality.
All the rest
- Release notes
See what has changed in recent Scrapy versions.
- Contributing to Scrapy
Learn how to contribute to the Scrapy project.
- Versioning and API stability
Understand Scrapy versioning and API stability.