Tested version running with simple (singular) test case

This commit is contained in:
Christian Wolf 2015-11-03 13:47:44 +01:00
commit 72e3427ea9

31
run.sh Executable file
View File

@ -0,0 +1,31 @@
#!/bin/sh
echo 'Loggin in'
curl -b cookies -c cookies -s -F 'email=ChristianLupus@web.de' -F 'form_id=packt_user_login_form' -F 'password=naitsirhc' -F 'op=Login' https://www.packtpub.com/ > /dev/null
echo 'Obtaining free book information'
url=$(curl -b cookies -c cookies -s https://www.packtpub.com/packt/offers/free-learning | grep freelearning-claim free.html | grep -o 'href="[^"]*' | grep -o '/free.*')
echo 'Claiming free book'
#curl -b cookies -c cookies https://www.packtpub.com$url
echo 'Downloading books'
id=$(echo $url | grep -o '/[0-9/]*/' | grep -o '[0-9]*')
#curl -b cookies -c cookies -J -O https://www.packtpub.com/ebook_download/$id/pdf
#curl -b cookies -c cookies -J -O https://www.packtpub.com/ebook_download/$id/epub
out=$(curl -b cookies -c cookies -J -O -O https://www.packtpub.com/ebook_download/$id/pdf https://www.packtpub.com/ebook_download/$id/epub 2>&1 )
ret=$?
echo 'Logging off'
curl -b cookies -c cookies -s https://www.packtpub.com/logout > /dev/null
if [ $ret -ne 0 ]; then
if [ $ret -eq 23 ]; then
echo Could not write file to file system:
fi
echo -e "$out"
fi