Skip to content

Commit 95ab4c2

Browse files
committed
Title with num prefix & curl download relocation
1 parent 7b2c461 commit 95ab4c2

File tree

1 file changed

+3
-3
lines changed

1 file changed

+3
-3
lines changed

packt.sh

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@ cex=$?; test "$cex" -ne "0" && { log "curl exit error code: $cex"; exit; }
2323
curl -s --retry $rtry -m $tout -A "$agent" -b "$cookie" -c "$cookie" https://www.packtpub.com/packt/offers/free-learning > packt_daily.html
2424
cex=$?; test "$cex" -ne "0" && { log "curl exit error code: $cex"; exit; }
2525

26-
title=$(grep "dotd-title" -A 2 packt_daily.html | tail -1 | sed 's/^[^A-Za-z]*//;s/[\t ]*<\/h2>$//')
26+
title=$(grep "dotd-title" -A 2 packt_daily.html | tail -1 | sed 's/^[^0-9A-Za-z]*//;s/[\t ]*<\/h2>$//')
2727
echo "Today's free e-book: $title"
2828
log "Today's free e-book: $title"
2929

@@ -38,13 +38,13 @@ log "e-Book claimed"
3838
book=$(echo $claim | sed 's/.*\/\([0-9]*\)\/.*/\1/')
3939

4040
# PDF download
41-
curl -s --retry $rtry -A "$agent" -b "$cookie" -c "$cookie" "https://www.packtpub.com/ebook_download/$book/pdf" > "$dldir/$title.pdf"
41+
curl -s -L --retry $rtry -A "$agent" -b "$cookie" -c "$cookie" "https://www.packtpub.com/ebook_download/$book/pdf" > "$dldir/$title.pdf"
4242
cex=$?; test "$cex" -ne "0" && { log "curl exit error code: $cex"; exit; }
4343
echo "PDF downloaded"
4444
log "PDF downloaded"
4545

4646
# Mobi download
47-
curl -s --retry $rtry -A "$agent" -b "$cookie" -c "$cookie" "https://www.packtpub.com/ebook_download/$book/mobi" > "$dldir/$title.mobi"
47+
curl -s -L --retry $rtry -A "$agent" -b "$cookie" -c "$cookie" "https://www.packtpub.com/ebook_download/$book/mobi" > "$dldir/$title.mobi"
4848
cex=$?; test "$cex" -ne "0" && { log "curl exit error code: $cex"; exit; }
4949
echo "Mobi downloaded"
5050
log "Mobi downloaded"

0 commit comments

Comments
 (0)