How imshoaibarshad/web-scraper works
This is a command-line scraper for books.toscrape.com. The user configures a crawl; the CLI invokes the crawl driver, which fetches listing pages, parses book records, follows pagination, and optionally fetches and parses product details. The CLI then selects CSV or JSON output and reports crawl statistics. The README documents the main capabilities; the shown source confirms the runtime calls and parsing stages. The map omits tests and build machinery.
Main entry points: scraper.py Crawl driver · run.py CLI · http.py HTTP fetch · parse.py Listing parser
Components 13
Crawl and parsing
- Crawl driver
src/scraper.py - HTTP fetch
src/http.py - Listing parser
src/parse.py - Pagination parser
src/parse.py - Detail enrichment
src/scraper.py - Product detail parser
src/parse.py - Book records
src/parse.py
Command-line orchestration
- CLI
run.py
Output
- CSV writer
src/scraper.py - JSON writer
src/scraper.py
Other components
- User
- Book website
- Output files
Connections 15
- User → CLI: configures
run.py - CLI → Crawl driver: starts crawl
run.py - Crawl driver → HTTP fetch: fetches pages
src/scraper.py - HTTP fetch → Book website: requests pages
README.md - Crawl driver → Listing parser: parses listings
src/scraper.py - Crawl driver → Pagination parser: finds next page
src/scraper.py - Listing parser → Book records: creates records
src/parse.py - Crawl driver → Detail enrichment: optionally enriches
src/scraper.py - Detail enrichment → HTTP fetch: fetches products
src/scraper.py - Detail enrichment → Product detail parser: parses details
src/scraper.py - Product detail parser → Book records: supplies fields
src/parse.py - CLI → CSV writer: selects CSV
run.py - CLI → JSON writer: selects JSON
run.py - CSV writer → Output files: writes CSV
src/scraper.py - JSON writer → Output files: writes JSON
src/scraper.py