Claim Your Free PacktPub eBook automatically.
Quickstart:
$ pip install freepacktbook
$ export [email protected]
$ export PACKTPUB_PASSWORD=my_password
$ export ANTICAPTCHA_KEY=api_key
$ claim_free_ebookFreepacktbook uses paid captcha solving service Anti-Captcha (referral link), which costs $2 for 1k captchas.
Claim your daily free PacktPub ebook and download it:
$ export PACKTPUB_BOOKS_DIR=/path/to/my/books
$ claim_free_ebook --downloadDownload all your ebooks:
freepacktbook allows you to backup all your ebooks and code files.
$ download_ebooks --formats mobi pdf --with-code-filesTo see more information:
$ download_ebooks -hCron configuration:
Edit the current crontab:
$ crontab -eAdd the following lines:
#!/bin/bash
SHELL=/bin/bash
PACKTPUB_EMAIL='[email protected]'
PACKTPUB_PASSWORD='my_password'
ANTICAPTCHA_KEY='api_key'
0 8 * * * /path/to/claim_free_ebook >> /tmp/claim_free_ebook.log 2>&1This command shows the direct path to claim_free_ebook:
which claim_free_ebookSlack integration
Set additionally the following environment variables:
export SLACK_URL=https://hooks.slack.com/services/...
export SLACK_CHANNEL=random
$ claim_free_ebook --slackPushover integration
Set additionally the following environment variables:
export PUSHOVER_USER=random
export PUSHOVER_TOKEN=random
$ claim_free_ebook --pushoverYou can build your own docker image containing configured cron service. By default, the claim_free_ebook command is run daily at 8:00am CEST. See Dockerfile.
Build an image:
$ docker build -t freepacktbook .If you want to change the default time zone, use the TZ build argument:
$ docker build --build-arg TZ=UTC -t freepacktbook .Run a new container:
$ docker run -d \
--name freepacktbook \
-e PACKTPUB_EMAIL=<my-packtpub-email> \
-e PACKTPUB_PASSWORD=<my-packtpub-password> \
-e ANTICAPTCHA_KEY=<api_key> \
freepacktbookThe PACKTPUB_ARGS env variable passes the additional arguments to the claim_free_ebook command:
$ docker run -d \
--name freepacktbook \
--restart=always \
-e PACKTPUB_EMAIL=<my-packtpub-email> \
-e PACKTPUB_PASSWORD=<my-packtpub-password> \
-e ANTICAPTCHA_KEY=<api_key> \
-e PACKTPUB_ARGS='--download' \
-v <path-to-books-dir>:/data \
freepacktbookAlso available on Docker Hub bogdal/freepacktbook:latest
