kirinnee / oreilly-downloader

Download Oreilly books as epub
258 stars 34 forks source link

Add automation script #12

Open marcelobaptista opened 1 month ago

marcelobaptista commented 1 month ago

This script downloads books from O'Reilly Learning Platform


#!/bin/bash

# Path to the cookie file

cookie_file="./cookie.json" 

# Books IDs

books=(
  id_of_book_1
  id_of_book_2
  id_of_book_3
  ...
  ...
  id_of_book_n
)

# Loop through the books and download them

for book_id in "${books[@]}"; do
  title=$(curl "https://learning.oreilly.com/api/v2/search/?query=archive_books_id:${book_id}" | 
     jq -r '.results[0].title')
  (<${cookie_file} docker run -i kirinnee/orly:latest sso "${book_id}") >"${title}.epub"
done
aliriomambo commented 3 weeks ago

How do you deal with the cookie expiration?