Skip to main content

LinkWalker

LinkWalker is a Python library for deep URL crawling and walking. It supports both dynamic browser-based crawling (using Playwright) and static HTTP crawling, allowing you to traverse websites, extract links, and filter URLs with ease. Perfect for developers building scrapers, bots, or web analyzers.

Features

  • Dynamic crawling with Playwright (handles JavaScript-heavy pages)
  • Static HTTP crawling using aiohttp for lightweight scraping
  • Deep crawling with configurable max depth
  • URL filtering:
    • Include or exclude URLs based on substrings
    • Clean URLs by removing query parameters
    • Blacklist certain file extensions
    • HTTPS-only option
  • Domain control: restrict crawling to specific domains or subdomains
  • Callbacks: execute custom logic on each page visited
  • Concurrency control with adjustable max parallel pages

Installation

pip install linkwalker

Example Usage

Dynamic Browser Walker

import asyncio
from linkwalker.spider.dynamic import BrowserWalker
from linkwalker.spider._types import BrowserWalkOptions
from playwright.async_api import Page

async def on_page(page: Page, html):
    print("Visited:", page.url)

async def main():
    walker = BrowserWalker(headless=True, max_pages=4)
    await walker.start()

    options: BrowserWalkOptions = {
        "https_only": False,
        "clean_url": True,
        "max_depth": 2,
        "on_page": on_page,
        "allow_all_domains": False,
    }

    urls = await walker.walk(origin_url="https://example.com", options=options)
    print(f"Found {len(urls)} URLs")

    await walker.close()

asyncio.run(main())

Static HTTP Walker

import asyncio
from linkwalker.spider.static import HTTPWalker
from linkwalker.spider._types import HTTPWalkOptions

async def on_page(url, html):
    print("Visited:", url)

async def main():
    walker = HTTPWalker(max_pages=5)
    await walker.start()

    options: HTTPWalkOptions = {
        "https_only": False,
        "clean_url": True,
        "max_depth": 2,
        "on_page": on_page,
        "allow_all_domains": False,
        "url_must_contain": ["/tag/", "/author/"],
        "url_must_not_contain": ["/page/"]
    }

    urls = await walker.walk(origin_url="https://quotes.toscrape.com", options=options)
    print(f"Found {len(urls)} URLs")

    await walker.close()

asyncio.run(main())

Contributing

Feel free to submit issues or pull requests. Contributions to improve crawling efficiency, filtering, or feature support are welcome.

License

MIT License

Metadata

Release files for linkwalker 0.9.0

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for linkwalker 0.9.0
File Size Uploaded
linkwalker-0.9.0.tar.gz 8.9 kB Details

Built distribution (wheel)

Table of built distributions (wheels) for linkwalker 0.9.0
File Interpreter ABI Platform
linkwalker-0.9.0-py3-none-any.whl Python 3 none any Details

Total release size: 18.8 kB

Release files / linkwalker-0.9.0.tar.gz

Download URL linkwalker-0.9.0.tar.gz
Size 8.9 kB
Tags Source
SHA-256 checksum
How to use checksums
b40a06b4e445e2f4fa39db5952b725b64186f60d52a0a7191d048d862df655ec
BLAKE2b-256 checksum
How to use checksums
d377642c46a664c098e65e7928b8fde28fdea67bd1d2b921247fdff184f76b4e
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/6.1.0 CPython/3.13.7

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Oct 21, 2025.

Transparency log

Release files / linkwalker-0.9.0-py3-none-any.whl

Download URL linkwalker-0.9.0-py3-none-any.whl
Size 9.9 kB
Tags Python 3
SHA-256 checksum
How to use checksums
2f36d976b2a81feaa532dfaa65a8d0e67fdb6e37d1624d0b8a93aeac2d136c2e
BLAKE2b-256 checksum
How to use checksums
d8041ffbc25cfd0660895807c4fbea9715088910bf6e988e6ceb8f79cf693233
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/6.1.0 CPython/3.13.7

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Oct 21, 2025.

Transparency log

Release history Release notifications | RSS feed

This release

0.9.0 This release

2 release files

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page