A lightweight, asynchronous Python tool to scrape Scribd documents and assemble them into a single, high-quality PDF.
- No Account or Browser Automation Required: Fetches public embed manifests and page assets directly over HTTP.
- Bot Detection Bypass: Uses browser TLS impersonation via
curl_cffito avoid Cloudflare/bot challenges. - Asynchronous Concurrent Downloads: Downloads page scans concurrently with polite rate-limiting via semaphores.
- Accurate Pagination: Automatically detects intentionally blank divider pages and generates matching blank canvas pages to maintain exact document pagination.
- High-Quality PDF Compilation: Combines images and blank pages into a unified PDF using Pillow.
- Interactive CLI: Real-time progress bars and status reporting powered by
rich.
- Python 3.10+ (tested on Python 3.11)
- Python packages:
curl_cffi(HTTP client with browser TLS impersonation)pillow(image processing and PDF generation)rich(CLI terminal formatting and progress bar)pytest(optional, for running tests)
If setting up in a new environment, install the required dependencies:
pip install curl_cffi pillow rich pytestScrape a Scribd document by providing its full URL or numeric document ID:
python main.py https://www.scribd.com/document/730511888/Iswara-owner-manualIf no URL is provided, it defaults to the target document configured in main.py.
Save the resulting PDF to a custom filename or folder:
python main.py https://www.scribd.com/document/730511888/Iswara-owner-manual -o output/Iswara_Manual.pdfIncrease or decrease concurrent download threads (default is 5):
python main.py https://www.scribd.com/document/730511888/Iswara-owner-manual -c 10By default, downloaded images are cached in an output .cache_<id> directory for faster resume. To automatically remove the cache folder after PDF compilation:
python main.py https://www.scribd.com/document/730511888/Iswara-owner-manual --clean-cache| Argument | Flag | Default | Description |
|---|---|---|---|
url |
(positional) | Default URL in main.py |
Scribd document URL or numeric ID |
--output |
-o |
output/<title>.pdf |
Output PDF file path or directory |
--concurrency |
-c |
5 |
Number of simultaneous downloads |
--clean-cache |
False |
Purge temporary image cache after PDF generation |
ScribdScraper/
├── main.py # CLI entry point, argument parsing, orchestration
├── resolver.py # URL parsing, embed HTML fetching, JSONP manifest parsing
├── downloader.py # Async image downloader & blank page generator
├── pdf_builder.py # Multi-page PDF assembly using Pillow
├── models.py # Data classes (PageInfo, DocumentMetadata)
└── tests/
└── test_scraper.py # Unit tests for models, URL extraction, and PDF generation
Execute the automated test suite using pytest:
python -m pytest -v tests/