{"id":33376339,"url":"https://github.com/varunbhandarii/universal-doc-downloader","last_synced_at":"2026-05-15T02:12:50.313Z","repository":{"id":325197114,"uuid":"1100212293","full_name":"varunbhandarii/universal-doc-downloader","owner":"varunbhandarii","description":"A CLI tool that crawls documentation sites and converts them into a single, clean PDF. Handles dynamic sidebars, SPA navigation, and CSS sanitization for offline reading.","archived":false,"fork":false,"pushed_at":"2025-11-20T02:51:07.000Z","size":8,"stargazers_count":0,"open_issues_count":0,"forks_count":0,"subscribers_count":0,"default_branch":"main","last_synced_at":"2025-11-20T04:18:24.632Z","etag":null,"topics":["automation","cli","documentation-downloader","offline-docs","pdf-generation","playwright","python","weasyprint","web-crawler","web-scraping"],"latest_commit_sha":null,"homepage":"","language":"Python","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/varunbhandarii.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null,"zenodo":null,"notice":null,"maintainers":null,"copyright":null,"agents":null,"dco":null,"cla":null}},"created_at":"2025-11-20T01:41:46.000Z","updated_at":"2025-11-20T02:51:10.000Z","dependencies_parsed_at":null,"dependency_job_id":null,"html_url":"https://github.com/varunbhandarii/universal-doc-downloader","commit_stats":null,"previous_names":["varunbhandarii/universal-doc-downloader"],"tags_count":null,"template":false,"template_full_name":null,"purl":"pkg:github/varunbhandarii/universal-doc-downloader","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/varunbhandarii%2Funiversal-doc-downloader","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/varunbhandarii%2Funiversal-doc-downloader/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/varunbhandarii%2Funiversal-doc-downloader/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/varunbhandarii%2Funiversal-doc-downloader/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/varunbhandarii","download_url":"https://codeload.github.com/varunbhandarii/universal-doc-downloader/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/varunbhandarii%2Funiversal-doc-downloader/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":285879574,"owners_count":27247109,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","status":"online","status_checked_at":"2025-11-22T02:00:05.934Z","response_time":64,"last_error":null,"robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":true,"can_crawl_api":true,"host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["automation","cli","documentation-downloader","offline-docs","pdf-generation","playwright","python","weasyprint","web-crawler","web-scraping"],"created_at":"2025-11-23T00:01:17.184Z","updated_at":"2025-11-23T00:02:36.977Z","avatar_url":"https://github.com/varunbhandarii.png","language":"Python","funding_links":[],"categories":[],"sub_categories":[],"readme":"# Universal Doc Downloader\n\n[![License: MIT](https://img.shields.io/badge/License-MIT-yellow.svg)](https://opensource.org/licenses/MIT)\n[![Python 3.8+](https://img.shields.io/badge/python-3.8+-blue.svg)](https://www.python.org/downloads/)\n\nA robust command-line tool to crawl, scrape, and convert modern documentation websites (React, Vue, Docusaurus, Sphinx, Redocly) into clean, offline PDFs.\n\nUnlike standard HTML-to-PDF converters, this tool uses a **headless browser (Playwright)** to render client-side JavaScript, ensuring that Single Page Applications (SPAs) and dynamic sidebars are captured correctly.\n\n## Features\n\n- **Dynamic Spider:** Auto-detects sidebars, TOCs, and navigation menus even if rendered via JS. Includes fallback strategies for difficult sites.\n- **Smart Sanitizer:** Strips \"web\" artifacts (Copy buttons, navbars, footers, breadcrumbs) to create a book-like reading experience.\n- **Professional PDF Output:** Generates a custom Cover Page, Table of Contents with real page numbers, and rewires web links to point to internal PDF chapters.\n- **Interactive Mode:** If the spider fails to find links automatically, a visible browser launches to allow manual selector identification.\n- **Universal Support:** Pre-configured for Flask, React, Playwright, ReadTheDocs, and Redocly, with generic support for others.\n\n## Prerequisites\n\n- Python 3.8+\n- **Windows Users:** [GTK3 Runtime](https://github.com/tschoonj/GTK-for-Windows-Runtime-Environment-Installer/releases) (Required for WeasyPrint PDF generation).\n\n## Installation\n\n1.  **Clone the repository:**\n\n    ```bash\n    git clone https://github.com/YOUR_USERNAME/universal-doc-downloader.git\n    cd universal-doc-downloader\n    ```\n\n2.  **Create a virtual environment (recommended):**\n\n    ```bash\n    python -m venv venv\n    # Windows:\n    .\\venv\\Scripts\\activate\n    # Mac/Linux:\n    source venv/bin/activate\n    ```\n\n3.  **Install dependencies:**\n\n    ```bash\n    pip install -r requirements.txt\n    ```\n\n4.  **Install browser binaries:**\n    This tool requires Chromium to render pages.\n    ```bash\n    playwright install chromium\n    ```\n\n## Usage\n\n### Basic Usage\n\nPass the URL of the documentation homepage. The tool attempts to auto-detect the sidebar selector.\n\n```bash\npython doc_dl.py https://flask.palletsprojects.com/en/stable/\n```\n\n### Custom Output \u0026 Metadata\n\n```bash\npython doc_dl.py https://playwright.dev/python/docs/intro \\\n  --title \"Playwright Python Manual\" \\\n  --output playwright.pdf\n```\n\n### Testing (Limit Pages)\n\nDownload only the first 5 pages to test the layout before scraping the whole site.\n\n```bash\npython doc_dl.py https://docs.bria.ai/ --limit 5\n```\n\n### Manual Selector\n\nIf the auto-detection fails, inspect the website and provide the CSS selector for the sidebar navigation.\n\n```bash\npython doc_dl.py https://example.com/docs --selector \"div.my-custom-menu\"\n```\n\n### Debugging\n\nRun with the browser visible to watch the scraping process.\n\n```bash\npython doc_dl.py https://example.com/docs --visible --verbose\n```\n\n## Command Line Options\n\n| Flag         | Short | Description                           | Default         |\n| :----------- | :---- | :------------------------------------ | :-------------- |\n| `url`        |       | The target URL (Required)             | N/A             |\n| `--output`   | `-o`  | Filename for the generated PDF        | `manual.pdf`    |\n| `--title`    | `-t`  | Title displayed on the cover page     | \"Documentation\" |\n| `--selector` | `-s`  | CSS selector for the sidebar          | Auto-detect     |\n| `--limit`    | `-l`  | Stop after N pages (0 = download all) | `0`             |\n| `--visible`  |       | Run browser in headful mode (visible) | `False`         |\n| `--verbose`  | `-v`  | Enable detailed debug logging         | `False`         |\n\n## License\n\nDistributed under the MIT License. See `LICENSE` for more information.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fvarunbhandarii%2Funiversal-doc-downloader","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fvarunbhandarii%2Funiversal-doc-downloader","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fvarunbhandarii%2Funiversal-doc-downloader/lists"}