markdown-crawler
paulpierre/markdown-crawler
A multithreaded web crawler that converts websites to markdown files for LLM RAG
Overview
markdown-crawler is a Python-based tool that recursively crawls through specified URLs or domains and converts the content of each page into a structured Markdown file. It includes features such as multi-threading, URL validation, configurable depth limits, support for tables and images, browser-like User-Agent headers, and more.
Categories
Tags
Similar tools
ECC
affaan-m/ECC
The agent harness performance optimization system
AutoGPT
Significant-Gravitas/AutoGPT
AutoGPT: Build, Deploy, and Run AI Agents
ollama
ollama/ollama
Get up and running with Kimi-K2.6, GLM-5.1, MiniMax, DeepSeek, gpt-oss, Qwen, Gemma and other models.
prompts.chat
f/prompts.chat
The world's largest open-source prompt library for AI
transformers
huggingface/transformers
🤗 Transformers: the model-definition framework for state-of-the-art machine learning models
JavaGuide
Snailclimb/JavaGuide
Snailclimb/JavaGuide: 面试 & 后端通用面试指南,覆盖计算机基础、数据库、分布式、高并发、系统设计与 AI 应用开发
Install
pip install markdown-crawlerREADME
| |
__ `__ \ _` | __| __| _` | \ \ \ / | _ \ __|
| | | ( | ( | ( | \ \ \ / | __/ |
_| _| _| \__._| \___| _| \__._| \_/\_/ _| \___| _|
---------------------------------
markdown_crawler - by @paulpierre
---------------------------------
A multithreaded 🕸️ web crawler that recursively crawls a website and creates a 🔽 markdown file for each page
https://github.com/paulpierre
https://x.com/paulpierre
📝 Overview
This is a multithreaded web crawler that crawls a website and creates markdown files for each page.
It was primarily created for large language model document parsing to simplify chunking and processing of large documents for RAG use cases.
Markdown by nature is human readable and maintains document structure while keeping a small footprint.
✨ Features include
- 🧵 Threading support for faster crawling
- ⏯️ Continue scraping where you left off
- ⏬ Set the max depth of children you wish to crawl
- 📄 Support for tables, images, etc.
- ✅ Validates URLs, HTML, filepaths
- ⚙️ Configure list of valid base paths or base domains
- 🚫 Exclude specific paths from crawling (
--exclude-paths)- 🎨 Configurable markdown heading style (
--heading-style)- 🌐 Browser-like User-Agent to bypass JS checks
- 🍲 Uses BeautifulSoup to parse HTML
- 🪵 Verbose logging option
- 👩💻 Ready-to-go CLI interface
- 🧪 Comprehensive test suite (95% coverage)
📦 What's New in v0.0.9
This release resolves 6 open issues and introduces several community-requested features:
| Issue | Fix |
|---|---|
| #7 | UnicodeEncodeError on non-ASCII content — UTF-8 encoding on all file writes |
| #8 | Bypass JavaScript checks — browser-like User-Agent header on all requests |
| #9 | Exclude paths from crawling — new --exclude-paths / -x CLI flag |
| #10 | target_content CSS selector handling — null href links now skipped |
| #11 | UnboundLocalError fix in get_target_content |
| #17 | Dependencies added to pyproject.toml for uvx support |
| #20 | Configurable heading_style for markdownify (ATX, UNDERLINE, etc.) |
Also includes a comprehensive test suite — 60 tests, 95% coverage. See the CHANGELOG.md for full details.
🏗️ Use cases
- RAG (retrieval augmented generation) - my primary usecase, use this to normalize large documents and chunk by header, pargraph or sentence
- LLM fine-tuning - Create a large corpus of markdown files as a first step and leverage
gpt-3.5-turboorMistral-7Bto extract Q&A pairs - Agent knowledge - Leverage this with autogen for expert agents, for example if you wish to reconstruct the knowledge corpus of a videogame or movie, use this to generate the given expert corpus
- Agent / LLM tools - Use this for online RAG learning so your chatbot continues to learn. Use SERP and scrape + index top N results w/ markdown-crawler
- many more ..
🚀 Get started
If you wish to simply use it in the CLI, you can run the following command:
Install the package
pip install markdown-crawler
Execute the CLI
markdown-crawler -t 5 -d 3 -b ./markdown https://en.wikipedia.org/wiki/Morty_Smith
To run from the github repo, once you have it checked out:
pip install .
markdown-crawler -t 5 -d 3 -b ./markdown https://en.wikipedia.org/wiki/Morty_Smith
Or use the library in your own code:
from markdown_crawler import md_crawl
url = 'https://en.wikipedia.org/wiki/Morty_Smith'
md_crawl(url, max_depth=3, num_threads=5, base_path='markdown')
⚠️ Requirements
- Python 3.x
- BeautifulSoup4
- requests
- markdownify
🔍 Usage
The following arguments are supported
usage: markdown-crawler [-h] [--max-depth MAX_DEPTH] [--num-threads NUM_THREADS] [--base-dir