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

Uploaded Python 3

File details

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

File metadata

  • Download URL: sitewise_crawler-0.1.3.tar.gz
  • Upload date:
  • Size: 15.0 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.3.tar.gz
Algorithm Hash digest
SHA256 2818288e2f5142604d918394adb53ef97e2817aa353a734977473708172c5513
MD5 09b15e863395e2433b89ea16ed86ba31
BLAKE2b-256 c7643ec1cebffe7664066273acb5358995f1767467496fa29ff01c0f1acc6f69

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for sitewise_crawler-0.1.3-py3-none-any.whl
Algorithm Hash digest
SHA256 932676ac24217b1793e5df37c143554b4cb83ade9b1307b25af4a32e1aa3e872
MD5 83885b4369607a7b9228e99345bf8a62
BLAKE2b-256 d16250741398240c9f3fc388680e4113dd13e1f73b6675de133ae6fbc0c8d47c

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