Skip to content

Instantly share code, notes, and snippets.

@utzig
Created July 30, 2013 23:52
Show Gist options
  • Save utzig/6118121 to your computer and use it in GitHub Desktop.
Save utzig/6118121 to your computer and use it in GitHub Desktop.
#!/bin/bash
URL="http://www.revistabula.com/647-100-livros-classicos-para-download/"
wget ${URL}
lines=$(grep "http://www\.dominiopublico" index.html)
echo "$lines" | while read line; do
obra=$(echo "$line" | sed 's/^.*co_obra=\([^\"]*\).*$/\1/g')
titulo=$(echo "$line" | sed 's/.*>\(.*\) <\/a>.*$/\1/g')
autor=$(echo "$line" | sed 's/.*a>— *\(.*\)<\/strong>.*$/\1/g')
livro="${autor} - ${titulo}.pdf"
link="http://www.dominiopublico.gov.br/pesquisa/DetalheObraDownload.do?select_action=&co_obra=${obra}&co_midia=2"
wget -O "${livro}" "${link}&co_midia=2"
done
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment