Skip to content

Add support for downloading book from book id #8

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 4 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 9 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -102,3 +102,12 @@ venv.bak/

# mypy
.mypy_cache/

# VSCode
.vscode

# SonarLint
.sonarlint

# Downloaded Media
media/

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Maybe you can erase this part, because this is a really good option and i really want to use it. Thanks both!

1 change: 1 addition & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@ Since PacktPub restructured their website [packtpub-library-downloader](https://
- *-s*, *--separate* = Create a separate directory for each book
- *-v*, *--verbose* = Show more detailed information
- *-q*, *--quiet* = Don't show information or progress bars
- *-i*, *--ids* = Products to download by id (If it is not specified, it will download all products that you have purchased)

**Book File Types**

Expand Down
6 changes: 6 additions & 0 deletions config.py
Original file line number Diff line number Diff line change
Expand Up @@ -9,12 +9,18 @@
# this is base url where i do the requests
BASE_URL = "https://services.packtpub.com/"

# this is base url for static content
BASE_STATIC_URL = "https://static.packt-cdn.com/"

# URL to request jwt token, params by post are user and pass, return jwt token
AUTH_ENDPOINT = "auth-v1/users/tokens"

# URL to get all your books, two params that i change are offset and limit, method GET
PRODUCTS_ENDPOINT = "entitlements-v1/users/me/products?sort=createdAt:DESC&offset={offset}&limit={limit}"

# URL to get book information from id
PRODUCT_FROM_ID_ENDPOINT = "products/{id}/summary"

# URL to get types , param is book id, method GET
URL_BOOK_TYPES_ENDPOINT = "products-v1/products/{book_id}/types"

Expand Down
Loading