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.2.tar.gz (14.9 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.2-py3-none-any.whl (14.8 kB view details)

Uploaded Python 3

File details

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

File metadata

  • Download URL: sitewise_crawler-0.1.2.tar.gz
  • Upload date:
  • Size: 14.9 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.1.0 CPython/3.13.12

File hashes

Hashes for sitewise_crawler-0.1.2.tar.gz
Algorithm Hash digest
SHA256 1eecf72694eeafbd30ff11f0efa7607bc20d208434e05c3892f8f093e28b25ec
MD5 051de2f21a4b40d549f10dc2b2f349fa
BLAKE2b-256 bfc34b381e8cb3b58d4ba4bea8d9eb15a33ee6cb994b30bb9088712398831e2e

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for sitewise_crawler-0.1.2-py3-none-any.whl
Algorithm Hash digest
SHA256 297bf77a4ea57a8900b94b2c65b5d174cc47e3755bfaf7a976e1317e793e026e
MD5 5f40128a4ebbd5ffe70a50443aedac3d
BLAKE2b-256 f0eb3d7df7dd87471878e2f245c58dea4131beb331c00be8aa420f94f6e6cf29

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