Skip to content
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

Allow multiple simultaneous BOOK_IDs and/or playlist ID #89

Open
wants to merge 5 commits into
base: master
Choose a base branch
from

Conversation

detvdl
Copy link

@detvdl detvdl commented Apr 14, 2019

Adds functionality to specify multiple book ids at once to be downloaded sequentially, as well as the possibility to specify a playlist id, to download all books gathered in the playlist.

My apologies for the many whitespace-related edits, but I have an editor plugin that automatically cleans up trailing whitespace.

@detvdl detvdl force-pushed the master branch 8 times, most recently from 45758eb to 88aec17 Compare April 19, 2019 11:00
@timblaktu
Copy link

@detvdl this is a useful feature, thanks for contributing. Can you describe how this has been tested? You might get more traction upstream if this is shown.

FWIW, I haven't tried your code yet, but I'm doing essentially the same thing in the shell outside safaribooks.py:

# Fetch all bookids from all playlists
curl -H 'Accept: application/json' https://learning.oreilly.com/api/v2/collections > collections.json
OREILLY_BOOK_IDS="$(jq -r '.[].content[].ourn | select(. | contains("urn:orm:book")) | sub("urn:orm:(?<type>[a-zA-Z0-9-]+):(?<id>[0-9]+)"; "\(.id)"; "g")' collections.json)"
for id in ${OREILLY_BOOK_IDS}; do
    echo "Fetching $id..."
    python safaribooks.py "$id"
done

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants