Last active
August 17, 2017 05:00
-
-
Save rbf/7e68eba13a6e6a4c0e058748c48a96f4 to your computer and use it in GitHub Desktop.
Script to batch download Free Programming Ebooks form O'Reilly Media (see https://pinboard.in/u:rbf/b:5ef50c7b00de)
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
# Download O'Reilly free programming ebooks | |
# SOURCE: https://pinboard.in/u:rbf/b:5ef50c7b00de | |
# SOURCE: https://www.reddit.com/r/programming/comments/6do7ih/free_programming_ebooks/di4ml1r/ | |
# Fail fast | |
set -eox pipefail | |
section=("data" "security" "business" "web-platform" "webops" "programming" "iot" "design") | |
for i in "${section[@]}" | |
do | |
echo Processing category ${i}... | |
mkdir $i || true | |
cd $i | |
curl http://www.oreilly.com/$i/free/ | tr '"' \\n | grep http | grep free | cut -d "?" -f1 | sed 's/free/free\/files/' | sed 's/\.csp/\.pdf/' | grep .pdf | xargs -n1 -P4 curl -sLO --compressed || true | |
cd .. | |
done |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment