๐โก๏ธ๐ Convert web content to Markdown & JSON files to fuel your GPTs !
5.5K
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. ๐ค๐ก
(Or even better, use Docker!โ ๐ณ)
pipx install crawler-to-md
pip install crawler-to-md
Then run the scraper:
crawler-to-md --url https://www.example.com
--export-individual is used. ๐Python 3.10 or higher is required.
Project dependencies are managed with pyproject.toml. Install them with:
pip install .
Start scraping with the following command:
crawler-to-md --url <URL> [--output-folder ./output] [--cache-folder ./cache] [--overwrite-cache|-w] [--base-url <BASE_URL>] [--exclude-url <KEYWORD_IN_URL>] [--title <TITLE>] [--urls-file <URLS_FILE>] [-p <PROXY_URL>]
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). ๐พ--overwrite-cache, -w: Overwrite existing cache database before scraping. ๐งน--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-url, -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). ๐--proxy, -p: Proxy URL for HTTP or SOCKS requests. ๐--include, -i: CSS-like selector (#id, .class, tag) to include before Markdown conversion (repeatable). โ
--exclude, -x: CSS-like selector (#id, .class, tag) to exclude before Markdown conversion (repeatable). ๐ซOne of the --url or --urls-file options is required.
By default, the WARN level is used. You can change it with the LOG_LEVEL environment variable.
Run with Docker:
docker run --rm \
-v $(pwd)/output:/app/output \
-v cache:/home/app/.cache/crawler-to-md \
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>
Contributions are welcome! Feel free to submit pull requests or open issues. ๐
Content type
Image
Digest
sha256:98bc5fd6bโฆ
Size
140 MB
Last updated
3 months ago
docker pull obeoneorg/crawler-to-md