A simple Python script for claim free book from PacktPub, and also download from your library.
First, install all requirements, run following command in root folder:
pip3 install -r requirements.txtSecond, you can check with help of file:
python3 script.py -hYou must config your credential.json before you do everything. You can easily make from sample by:
cp credential.json.example credential.jsonPlease put your user name after "name": and your password after "pass":
-
If you just want to claim a free book:
python3 script.py -c
-
If you want to notify yourself with ifttt webhook:
You have to config the
iftttfield incredential.jsonfile. If you don't know what is a key or what is IFTTT, please check with IFTTT - Webhook.python3 script.py -n ifttt
-
If you want to notify yourself with mailgun email service:
You have to config the
mailgunfield incredential.jsonfile. You can go to Mailgun to register for a new account (which is free). After login, you can find your api key on your dashboard (findPrivate API Keyin page ) and domain name after clickingDomaintab. If you don't have any domain yourself, the sandbox domain is good to use.python3 script.py -n mailgun -
If you just want to download a book (first book in your library):
python3 script.py -d 1
-
If you want to download a book with type epub (default is pdf) to desktop:
python3 script.py -d 1 -t epub --dir ~/Desktop/ -
If you want to claim and then download:
python3 script.py -c -d 1
-
If you want to upload to dropbox:
You have to config
dropboxfield incredential.jsonfile. You can go to Dropbox Developers to create an app for this use. You do have to generateaccess tokenand put intocredential.jsonfile.Note: Upload choice must be used as same time at download
python3 script.py -d 1 -u dropbox
- Add Google Drive support
- Download book from multiple pages