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.1.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.1-py3-none-any.whl (21.7 kB view details)

Uploaded Python 3

File details

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

File metadata

  • Download URL: html_docs_crawler-0.1.1.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.1.tar.gz
Algorithm Hash digest
SHA256 3e23f3698de66b46d280349e0dc9c47982bbfba912cce984c0de93b6efff6cd3
MD5 3cfdfda6a21f42c18dd5f361cd815c08
BLAKE2b-256 9d75ebdf19436dc8cdf682c953f5433295d1f7629d3faaa83b95730724065b25

See more details on using hashes here.

File details

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

File metadata

  • Download URL: html_docs_crawler-0.1.1-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.1-py3-none-any.whl
Algorithm Hash digest
SHA256 141857b80a1e55a27d9fd0666e3ecd96c518bdd667f76069ed7d6c1928b3da97
MD5 37a3bf64a60e35112573320f9735d30f
BLAKE2b-256 8408e9f8d643321b7de761bf40d971569af5f7c965c029406f467029df0a4b6e

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