Skip to main content

Universal documentation crawler that converts HTML pages to Markdown with internal link correction

Project description

html-docs-crawler

A Scrapy-based universal documentation crawler that converts HTML documentation sites to Markdown format, with automatic internal link rewriting to local .md relative paths. Supports multiple converter engines (markitdown / html2text), path whitelist filtering, and automatic media file download.

Parameters

  • start_urls: Starting URLs (comma-separated)
  • allowed_domains: Allowed domains (comma-separated)
  • deny_patterns: Regex deny patterns (comma-separated)
  • allow_paths: Allowed path prefixes (comma-separated); only URLs starting with these prefixes will be processed
  • body_selector: CSS selector for main HTML content (default: "main, article, .content, .document, .body, body")
  • output_dir: Output directory (default: "~/.config/doc_crawler/_docs/{domain_name}", where {domain_name} is extracted from start_urls)
  • converter_engine: Converter engine (default: "markitdown", optional: "html2text")
  • single_page: Single-page mode (default: "false", set to "true" to crawl a single page without following links)

Install via UV

uv tool install html-docs-crawler

After installation, you can use the doc_crawler command from any directory.

Usage Examples

# Crawl AKShare documentation
doc_crawler --start-urls "https://akshare.akfamily.xyz" \
  --allowed-domains "akshare.akfamily.xyz" \
  --deny-patterns "/_sources/" \
  --body-selector "main, article, .content, .document, .body" \
  --output-dir "_docs/akshare_markdown"

Single-page mode

doc_crawler --start-urls "https://build123d.readthedocs.io/en/stable/examples_1.html" \
  --single-page true \
  --body-selector ".wy-nav-content" \
  --output-dir "single_page_output"

Path whitelist filtering

doc_crawler --start-urls "https://opencode.ai/docs/zh-cn/" \
  --allow-paths "/docs/zh-cn/" \
  --body-selector "main, article, .content" \
  --output-dir "_docs/opencode_docs_zh_cn"

Crawl with html2text engine

doc_crawler --start-urls "https://akshare.akfamily.xyz/" \
  --allowed-domains "akshare.akfamily.xyz" \
  --deny-patterns "/_sources/" \
  --body-selector "main, article, .content, .document, .body" \
  --converter-engine "html2text" \
  --output-dir "_docs/akshare_markdown_html2text"

More examples

# Crawl build123d docs
doc_crawler --start-urls "https://build123d.readthedocs.io/en/stable/" \
  --deny-patterns "/_sources/,/latest/" \
  --body-selector ".wy-nav-content" \
  --output-dir "_docs/build123d"

# Crawl Docusaurus docs
doc_crawler --start-urls "https://docusaurus.io/docs" \
  --allow-paths "/docs" \
  --body-selector ".col.docItemCol_n6xZ" \
  --output-dir "_docs/docusaurus"

# Crawl uv documentation
doc_crawler --start-urls "https://docs.astral.sh/uv/" \
  --body-selector ".md-content" \
  --output-dir "_docs/uv"

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

html_docs_crawler-0.1.2.tar.gz (19.4 kB view details)

Uploaded Source

Built Distribution

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

html_docs_crawler-0.1.2-py3-none-any.whl (21.7 kB view details)

Uploaded Python 3

File details

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

File metadata

  • Download URL: html_docs_crawler-0.1.2.tar.gz
  • Upload date:
  • Size: 19.4 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: uv/0.9.28 {"installer":{"name":"uv","version":"0.9.28","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"Ubuntu","version":"24.04","id":"noble","libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":null}

File hashes

Hashes for html_docs_crawler-0.1.2.tar.gz
Algorithm Hash digest
SHA256 e3ca1589be155a630b5d9577437805279137392e6727d127e60b728f578c11ea
MD5 642167a5aed28d685bed987add57aedf
BLAKE2b-256 91acbe7dba84438bca9a19d00cecbf1cb75408c0472cd22dcf2783d0da80074a

See more details on using hashes here.

File details

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

File metadata

  • Download URL: html_docs_crawler-0.1.2-py3-none-any.whl
  • Upload date:
  • Size: 21.7 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: uv/0.9.28 {"installer":{"name":"uv","version":"0.9.28","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"Ubuntu","version":"24.04","id":"noble","libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":null}

File hashes

Hashes for html_docs_crawler-0.1.2-py3-none-any.whl
Algorithm Hash digest
SHA256 55653147a3a0ee7550a397960eb94c6ae0d1dc700674662a063a09ff0e6e344b
MD5 fe65fde8522f69e3b8d31d5e26d7f3ea
BLAKE2b-256 ef15a812aa1f722e8a4917a6d53694bed02027f50fadc38aa9a3d73c450beefa

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