book-info.sh 786 B

12345678910111213141516
  1. #!/usr/bin/env bash
  2. set -euo pipefail # bash strict mode
  3. # Is there a better way to get easily parseable ISBN information on a book?
  4. # I made the script below, but after a few queries it locks up with a captcha and the output that I get is unusable because of it.
  5. # With this script, after reading a book I can input its ISBN and it will download an HTML document that I can open with firefox that looks like pic related.
  6. # MEDIADIR is exported in my /etc/profile.
  7. # I'm not sure if adding the "-q" to wget would mess up the output.
  8. BOOKPATH="$MEDIADIR/documents/books/read"
  9. read -p "Search for ISBN: " answer
  10. wget https://isbnsearch.org/isbn/$answer.tmp && cat $BOOKPATH/$answer.tmp | head -n 50 > $BOOKPATH/$answer && rm -rf $BOOKPATH/$answer.tmp
  11. # Any help would be appreciated.