Skip to main content

Convert web content to Markdown & JSON files to fuel your GPTs and agent AI!

Project description

Web Scraper to Markdown 🌐✍️

This Python-based web scraper fetches content from URLs and exports it into Markdown and JSON formats, specifically designed for simplicity, extensibility, and for uploading JSON files to GPT models. It is ideal for those looking to leverage web content for AI training or analysis. 🤖💡

🚀 Quick Start

(Or even better, use Docker! 🐳)

Recommended installation using pipx (isolated environment)

pipx install crawler-to-md

Alternatively, install with pip

pip install crawler-to-md

Then run the scraper:

crawler-to-md --url https://www.example.com

🌟 Features

  • Scrapes web pages for content and metadata. 📄
  • Filters links by base URL. 🔍
  • Excludes URLs containing certain strings. ❌
  • Automatically finds links or can use a file of URLs to scrape. 🔗
  • Rate limiting and delay support. 🕘
  • Exports data to Markdown and JSON, ready for GPT uploads. 📤
  • Exports each page as an individual Markdown file if --export-individual is used. 📝
  • Uses SQLite for efficient data management. 📊
  • Configurable via command-line arguments. ⚙️
  • Docker support. 🐳

📋 Requirements

Python 3.9 or higher is required.

Project dependencies are managed with pyproject.toml. Install them with:

pip install .

🛠 Usage

Start scraping with the following command:

crawler-to-md --url <URL> [--output-folder ./output] [--cache-folder ./cache] [--base-url <BASE_URL>] [--exclude <KEYWORD_IN_URL>] [--title <TITLE>] [--urls-file <URLS_FILE>]

Options:

  • --url, -u: The starting URL. 🌍
  • --urls-file: Path to a file containing URLs to scrape, one URL per line. If '-', read from stdin. 📁
  • --output-folder, -o: Where to save Markdown files (default: ./output). 📂
  • --cache-folder, -c: Where to store the database (default: ./cache). 💾
  • --base-url, -b: Filter links by base URL (default: URL's base). 🔎
  • --title, -t: Final title of the markdown file. Defaults to the URL. 🏷️
  • --exclude, -e: Exclude URLs containing this string (repeatable). ❌
  • --export-individual, -ei: Export each page as an individual Markdown file. 📝
  • --rate-limit, -rl: Maximum number of requests per minute (default: 0, no rate limit). ⏱️
  • --delay, -d: Delay between requests in seconds (default: 0, no delay). 🕒

One of the --url or --urls-file options is required.

📚 Log level

By default, the WARN level is used. You can change it with the LOG_LEVEL environment variable.

🐳 Docker Support

Run with Docker:

docker run --rm -v $(pwd)/output:/app/output -v cache:/app/cache ghcr.io/obeone/crawler-to-md --url <URL>

Build from source:

docker build -t crawler-to-md .
docker run --rm -v $(pwd)/output:/app/output crawler-to-md --url <URL>

🤝 Contributing

Contributions are welcome! Feel free to submit pull requests or open issues. 🌟

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

crawler_to_md-0.1.0.tar.gz (19.7 kB view details)

Uploaded Source

Built Distribution

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

crawler_to_md-0.1.0-py3-none-any.whl (14.3 kB view details)

Uploaded Python 3

File details

Details for the file crawler_to_md-0.1.0.tar.gz.

File metadata

  • Download URL: crawler_to_md-0.1.0.tar.gz
  • Upload date:
  • Size: 19.7 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.1.0 CPython/3.13.5

File hashes

Hashes for crawler_to_md-0.1.0.tar.gz
Algorithm Hash digest
SHA256 275fdb36fbd1614b7e311f2b266c434315320b524c9e83119b3c621f3b6d1089
MD5 2d0ad83e3ef5a0a2f22595321c06750d
BLAKE2b-256 7bf1669111a2ed3f6b3fe140d8985f08981ac5a33005566376caa339db236a02

See more details on using hashes here.

File details

Details for the file crawler_to_md-0.1.0-py3-none-any.whl.

File metadata

  • Download URL: crawler_to_md-0.1.0-py3-none-any.whl
  • Upload date:
  • Size: 14.3 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.1.0 CPython/3.13.5

File hashes

Hashes for crawler_to_md-0.1.0-py3-none-any.whl
Algorithm Hash digest
SHA256 840b05cd9990d51acb19263efdcf2f53bc07b04e63120c7b9c32a5d09f160efb
MD5 9ebd22961447563070230632d4db2a57
BLAKE2b-256 e2fe0b69173d3d57c3a52b02298b0c3167eeeeac2d51344f0ec9d7464e11e74f

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