A complete tool to extract and convert "Borrow Only" books from Internet Archive into local PDFs, bypassing timeout errors and download limitations.
Have you ever tried downloading a book from Internet Archive and encountered:
- ❌ Timeout errors (file too large)
- ❌ Corrupted or incomplete PDFs
- ❌ "Borrow Only" with no download option
- ❌ CSP/BLOB protections blocking traditional tools
This tool solves ALL these problems with a two-step approach:
- Browser Script: Captures pages visually directly from the browser (bypassing blob/CSP protections)
- PDF Binder: Combines all downloaded images into a clean, organized PDF file
⚠️ Legal Notice: This tool is intended for personal archival and research purposes. Respect copyright laws and Internet Archive's Terms of Service.
- Visit Internet Archive and log in
- Find your desired book and click "Borrow for 1 hour" (or 14 days)
- Open the book viewer
- Switch to "One-page view" - single page icon at the top
- Open Developer Console:
- Windows/Linux:
F12orCtrl + Shift + I - Mac:
Cmd + Option + I - Then click the "Console" tab
- Windows/Linux:
- Copy the script from
browser-script.jsfile (or see here) - Paste into console and press
Enter
What will happen:
- 🔄 Script will automatically turn pages
- 📥 Each page downloads as
.jpgto your Downloads folder - ⏳ Waits for complete loading before proceeding (resilient to slow internet)
- 📊 Shows real-time progress in console
-
Clone this repository:
git clone https://github.com/YuriTheCoder/archive-book-liberator.git cd archive-book-liberator -
Install dependencies:
npm install
-
Organize images:
- Move all downloaded images to the
images/folder (already exists) - Script automatically sorts them (even if filenames are out of order)
- Move all downloaded images to the
-
Run the converter:
npm start
-
Done! 🎉
Thebook.pdffile will be generated in the project root.
Many Archive.org books use CSP protections (Content Security Policy) and BLOBs that prevent simple downloads via fetch or direct download.
Our solution:
- Renders the protected image on an invisible
<canvas>in memory - Exports pixels to Base64 using
toDataURL() - Forces local download, bypassing network restrictions
- Automatically detects when page finishes loading to avoid:
- ❌ Blank images
- ❌ Duplicates
- ❌ Cropped pages
Technologies:
- HTML5 Canvas API
- Async/Await for flow control
- KeyboardEvent API for navigation
Uses Node.js to process images with:
- ✅ Natural Sort Algorithm (smart ordering): ensures
page_10.jpgcomes afterpage_9.jpg(not afterpage_1.jpg) - ✅ Multiple format support:
.jpg,.jpeg,.png - ✅ Robust validation: checks if folder exists and contains valid images
- ✅ Visual feedback: shows progress and detailed errors
Technologies:
- Node.js
fsmodule images-to-pdflibrary- Natural number sorting regex
archive-book-liberator/
├── browser-script.js ← 📋 Copy this code to browser console
├── src/
│ └── index.js ← 🔧 Node.js script that generates the PDF
├── images/ ← 📁 Put your images here (ignored by Git)
├── .gitignore ← 🚫 Prevents upload of images and node_modules
├── package.json ← 📦 Project dependencies
└── README.md ← 📖 You are here!
See the browser-script.js file for the most up-to-date version. Example snippet:
// ⚙️ CONFIGURATION - Change here!
let START_PAGE = 1; // First page to download
let END_PAGE = 688; // Last page to download
let BOOK_NAME = "book"; // Base filename
// The rest is automatic! 🚀- ✅ Make sure you're in "One-page view" mode
- ✅ Wait for page to fully load before running script
- ✅ Increase timeout in script (
IMAGE_TIMEOUTvariable) - ✅ Slow internet? Script already waits up to 15s automatically
- ✅ Script already sorts automatically! If still having issues, rename images with sequential numbers:
001.jpg,002.jpg, etc.
- ✅ Split into batches (e.g., pages 1-300, then 301-600)
- ✅ Browser may limit simultaneous downloads
Contributions are welcome! Feel free to:
- 🐛 Report bugs
- 💡 Suggest new features
- 🔧 Submit Pull Requests
- ⭐ Star this project if it helped you!
This project is under the MIT license - see the LICENSE file for details.
Disclaimer: This tool is for educational and personal archival use. Users are responsible for complying with copyright laws in their jurisdiction.
Developed with ❤️ by YuriTheCoder
Built to help researchers, students, and book enthusiasts worldwide.
If this project saved you hours of frustration, consider:
- ⭐ Giving it a star on GitHub
- 🔄 Sharing with others who need it
Happy reading! 📖✨