Prerequisites
Make sure you have Scrapling installed. If not, see the Installation guide. For the examples below, you’ll need:Your First Scrape
Let’s scrape a simple website using HTTP requests:1
Import the Fetcher
2
Fetch the page
3
Extract data with CSS selectors
Using Sessions
For multiple requests to the same domain, use sessions to maintain cookies and state:Stealthy Scraping
For websites with anti-bot protection, use the StealthyFetcher:1
Import StealthyFetcher
2
Fetch protected pages
3
Extract data
Building a Spider
For larger scraping projects, use Scrapling’s spider framework:1
Create a spider class
2
Define the parse method
3
Run the spider
Complete Spider Example
Spiders support pause/resume, multiple session types, proxy rotation, and streaming mode. See Spider Documentation for advanced features.
Multi-Session Spider
Use different session types in a single spider for optimal performance:Adaptive Scraping
Scrapling can automatically relocate elements when website structure changes:1
Enable adaptive mode
2
Save element locations
3
Relocate after changes
Navigation & Selection
Scrapling offers powerful element navigation:Command Line Usage
Scrape without writing code:.txtextension extracts text content.mdextension extracts Markdown representation.htmlextension extracts raw HTML
Next Steps
You’re now ready to explore Scrapling’s advanced features:Selection Methods
Master CSS, XPath, regex, and text search
Choose Your Fetcher
Learn when to use each fetcher type
Build Advanced Spiders
Concurrent crawls with pause/resume
Proxy Rotation
Built-in proxy rotation strategies
Interactive Shell
Speed up development with IPython
MCP Server
AI-assisted web scraping
Common Patterns
Handling Pagination
Handling Pagination
Extracting Attributes
Extracting Attributes
JSON Data Extraction
JSON Data Extraction
Error Handling
Error Handling