A simple script to download borrowed books in Internet Archive
Click here to access Internet Archive
You need an Internet Archive account that can borrow books.
install python 3
clone this repository, and in the project root:
python -m venv venv
.\venv\Scripts\activate
pip install -r requirements.txt
set directory to save the book in the source code:
SAVE_PATH = 'set your own save path'
borrow the book you want to download
get the cookie
and request example
. see How to get cookie and request example
start downloading
python src\download.py [options]
There 3 pairs of options you can use:
fail.log
OR download a New book with a page range [default]here are some examples:
python src\download.py (download a new book)
python src\download.py cr (download pages that weren't download correctly last time)
python src\download.py d (download without using proxy)
NOTE: Using proxy is set by DEFAULT. You can config your proxy in the source code:
PROXY = {
'http': 'http://127.0.0.1:4780', # replace with your own proxy
'https': 'http://127.0.0.1:4780', # replace with your own proxy
}
So, If you don't want to use proxy, don't forget to add option d
in the command.
python src\download.py
in the command line. You will be asked to input cookie and request example:
cookie > (you paste your cookie here)
request example > (you paste your request example url here)
page range > (you type your the page range here [format: begin-end]. note that the `begin` can be omit)
Then, the script will start downloading. You can take a cup of coffee till it finishes.
borrow
to borrow the book you want to downloadF12
to open the develop toolsNetwork
cookie
and Request URL
here are some variables you can customize:
WORKER_NUM = 6 # number of downloading threads
REQUEST_TIMEOUT = 8 # request timeout
TOKEN_INTV = 120 # interval time for getting token
DOWNLOAD_INTV = 0.1 # interval time between two downloads in one thread
F12
> Network
. Jump to a certain page as we want to see some connections.cookie
and Request URL
set the save path, paste the cookies and request url, and start downloading
then you'll get all the pages download
Now you have all the images of the book. I recommend you to use Cover to read the book, which can be found in Microsoft Store easily.
Hope you enjoy your reading.