Skip to main content

A flexible and advanced web crawler for modern SPAs and traditional websites.

Project description

Sitewise Crawler 🕷️

An advanced, flexible, and production-ready web crawler for modern websites. Automatically detects SPAs (Single Page Applications) and switches between fast requests fetching and full JavaScript rendering with Playwright.

✨ Features

  • 🚀 Hybrid Rendering: Automatically detects React, Vue, Angular, and Next.js to switch rendering engines on the fly.
  • 🧠 Smart Extraction: Built-in main content extraction that removes headers, footers, and sidebars.
  • 🔗 SPA Link Discovery: Discovers links even in complex client-side routers.
  • 🛠️ Fully Configurable: Control depth, concurrency, rate limits, and custom wait selectors.
  • 📝 Pydantic Models: Type-safe configuration and results.

📦 Installation

pip install sitewise-crawler
playwright install chromium

🚀 Quick Start

import asyncio
from sitewise_crawler import SPACrawler, CrawlerConfig

async def main():
    # 1. Configure the crawler
    config = CrawlerConfig(
        start_url="https://example.com",
        max_depth=2,
        max_pages=10,
        use_playwright=True,
        headless=True
    )

    # 2. Initialize and run
    crawler = SPACrawler(config)
    
    # Optional: Add a callback for each page crawled
    crawler.on_page_crawled = lambda page: print(f"Crawled: {page.url} | Title: {page.title}")

    result = await crawler.crawl()

    # 3. Process results
    if result.success:
        print(f"\n✅ Crawl complete! Found {result.total_pages} pages.")
        for page in result.pages_all:
            print(f"- {page.url} ({len(page.content)} chars)")

if __name__ == "__main__":
    asyncio.run(main())

⚙️ Configuration Options

The CrawlerConfig class supports the following parameters:

Parameter Type Default Description
start_url str Required The entry point for the crawler.
max_depth int 3 Maximum crawl depth from the start URL.
max_pages int 100 Stop crawling after this many pages.
use_playwright bool True Enable JavaScript rendering for SPAs.
headless bool True Run browser in headless mode.
rate_limit_delay float 1.0 Seconds to wait between requests.
wait_for_selector str None CSS selector to wait for before extracting SPA content.

🤝 Contributing

Contributions are welcome! Please feel free to submit a Pull Request.

📄 License

This project is licensed under the MIT License - see the LICENSE file for details.

sitewise_crawler

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

sitewise_crawler-0.1.0.tar.gz (12.6 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

sitewise_crawler-0.1.0-py3-none-any.whl (12.2 kB view details)

Uploaded Python 3

File details

Details for the file sitewise_crawler-0.1.0.tar.gz.

File metadata

  • Download URL: sitewise_crawler-0.1.0.tar.gz
  • Upload date:
  • Size: 12.6 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.12.4

File hashes

Hashes for sitewise_crawler-0.1.0.tar.gz
Algorithm Hash digest
SHA256 ad1cf0c230e337d814d79361d758efc98ca7576c149cba57216a8005a2730b31
MD5 77a207f39b65b375643da24734f9b885
BLAKE2b-256 3425ae7534375b99e7902a6d454704dab6788c7ae60058a41dd4256f85e9b8aa

See more details on using hashes here.

File details

Details for the file sitewise_crawler-0.1.0-py3-none-any.whl.

File metadata

File hashes

Hashes for sitewise_crawler-0.1.0-py3-none-any.whl
Algorithm Hash digest
SHA256 772c0cbb3d203aedd3c1da61ddbdb47097a9e6c62b0e59826dfe5e6fba110431
MD5 7235f1f24a48d9a2751c26d2f849971f
BLAKE2b-256 7829189ae089fc466a2f6f9ffbeea510357cab0d06ff98825ac373d40111942b

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page