wolnelektury-scrape.sh 539 B

12345678910111213141516
  1. #!/usr/bin/env bash
  2. set -euo pipefail # bash strict mode
  3. IFS=$'\n\t' # Internal Field Separator, controls word splitting, default is $' \n\t'
  4. api="https://wolnelektury.pl/api/books/"
  5. output_dir="${HOME}/Documents/wolnelektury/"
  6. curl -sS "$api" \
  7. | jq -r '.[]["href"]' \
  8. | xargs curl -sS -- \
  9. | jq -r '{epub,mobi,pdf,html,txt,fb2,xml} | values[]' \
  10. | xargs wget -c -P "$output_dir" --
  11. curl https://wolnelektury.pl/api/audiobooks/ | jq '.[]["href"]' | head -n1 | xargs curl -- | jq -r '.["media"][]["url"]' | grep ".ogg"