Skip to content

About

Web scraping toolkit with BeautifulSoup, Selenium and Playwright. Includes rate limiting, retries, User-Agent rotation and CSV, JSON and Parquet export with Polars.

Topics

Resources

Stars

0 stars

Watchers

0 watching

Forks

Repository files navigation

🕷️ Web Scraper Toolkit

A complete web scraping kit with BeautifulSoup, Selenium, and Playwright

CI Python Selenium Playwright License GitHub


📌 About the Project

A complete Python web scraping kit with 3 practical strategies: BeautifulSoup for static HTML, Selenium for legacy JavaScript-heavy pages, and Playwright for modern, asynchronous scraping. Includes rate limiting, retry with exponential backoff, User-Agent rotation, and export to CSV, JSON, and Parquet.

Features

  • ✅ 3 scraping strategies — static, Selenium, Playwright
  • ✅ Configurable rate limiting to avoid blocks
  • ✅ Automatic retry with exponential backoff
  • ✅ User-Agent rotation for ethical scraping
  • ✅ Flexible export — CSV, JSON, and Parquet
  • ✅ Polars-based processing — faster than Pandas
  • ✅ Structured logging for debugging

🛠️ When to Use Each Tool

Tool When to use
BeautifulSoup + Requests Static HTML, simple sites
Selenium JavaScript-heavy sites, browser automation
Playwright Modern, asynchronous, multi-browser support
Polars Ultra-fast data processing
Parquet Efficient columnar storage

📁 Structure

web-scraper-toolkit/
├── scrapers/
│   ├── bs4_scraper.py        # BeautifulSoup (static HTML)
│   ├── selenium_scraper.py   # Selenium (JavaScript)
│   └── playwright_scraper.py # Playwright (asynchronous)
├── utils/
│   ├── exporters.py          # CSV/JSON/Parquet exporters
│   └── rate_limiter.py       # Configurable rate limiting
├── examples/
│   ├── quotes_bs4.py         # Scraping quotes.toscrape.com
│   ├── books_selenium.py     # Scraping books.toscrape.com
│   └── news_playwright.py    # News scraping (async)
├── tests/
├── .github/workflows/ci.yml
├── requirements.txt
├── requirements-dev.txt
└── README.md

📦 Installation

git clone https://github.com/LacerdaTraderCode/web-scraper-toolkit.git
cd web-scraper-toolkit

python -m venv venv
source venv/bin/activate      # Linux/Mac
# venv\Scripts\activate       # Windows

pip install -r requirements.txt

# Install browsers for Playwright (first time only)
playwright install chromium

⚡ Usage Examples

BeautifulSoup — static HTML

python -m examples.quotes_bs4

Extracts quotes from quotes.toscrape.com, saves to CSV and Parquet.

Selenium — JavaScript-heavy sites

python -m examples.books_selenium

Navigates the books.toscrape.com catalog simulating a real user.

Playwright — asynchronous scraping

python -m examples.news_playwright

Collects headlines asynchronously (faster than Selenium).


📊 Performance — 100 pages

Tool Time CPU Recommended for
BeautifulSoup ~15s Low Simple sites
Selenium ~90s High Legacy JS-heavy sites
Playwright (async) ~25s Medium Modern projects

🧪 Development

pip install -r requirements-dev.txt
ruff check . && ruff format --check .
pytest -v

Browser drivers and HTTP sessions are mocked, so the test suite needs no browser or network access. The same checks run on every push and pull request via GitHub Actions.


⚖️ Ethical Use

This toolkit is for educational purposes. When scraping:

  • ✅ Respect the site's robots.txt
  • ✅ Use rate limiting to avoid overloading servers
  • ✅ Correctly identify your User-Agent
  • ✅ Respect the site's Terms of Use
  • ❌ Do not collect personal data without consent

✅ Requirements

  • Python 3.11 or higher

👤 Author

Wagner Lacerda — Senior Software Engineer | Python, Backend, AI Apps, Automation & Systems

GitHub LinkedIn YouTube Telegram Telegram Bots

📍 Rio Grande do Sul, Brazil


📄 License

Distributed under the MIT license. See LICENSE for more details.

About

Web scraping toolkit with BeautifulSoup, Selenium and Playwright. Includes rate limiting, retries, User-Agent rotation and CSV, JSON and Parquet export with Polars.

Topics

Resources

Stars

0 stars

Watchers

0 watching

Forks

Releases

Sponsor this project

Packages

Contributors

Languages