Skip to content

Instantly share code, notes, and snippets.

@wonderflow
Created December 23, 2014 07:05
Show Gist options
  • Save wonderflow/b1a35ce3fa0c6d7512dd to your computer and use it in GitHub Desktop.
Save wonderflow/b1a35ce3fa0c6d7512dd to your computer and use it in GitHub Desktop.
download book from http://book.xjpvictor.info/
URL=book.xjpvictor.info
ANS=""
for (( i=1; ; i++ ))
do
if [ $i = 1 ]
then
INDEX=`curl $URL | grep item | cut -f4 -d '"'`
ANS="$ANS $INDEX"
else
INDEX=`curl $URL/page/$i | grep item | cut -f4 -d '"'`
ANS="$ANS $INDEX"
fi
if [ ! "$INDEX" ]
then
break
fi
done
for j in $ANS
do
bookurl=`curl $URL/book/$j | grep epub | cut -f8 -d '"' `
bookurl=`echo $bookurl | sed -e "s/\&amp\;/\&/g" `
bookurl=`echo $bookurl | sed -e "s/\?/\\\?/g"`
bookurl=`echo $bookurl | sed -e "s/\=/\\\=/g"`
bookurl=`echo $bookurl | sed -e "s/\&/\\\&/g"`
name=`curl $URL/book/$j | grep title | grep name | cut -f2 -d '<' | cut -f2 -d '>'`
name=`echo $name`
wget -O "$name".epub $bookurl
echo $name done.
done
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment