Skip to content

Instantly share code, notes, and snippets.

@jostyee
Created June 14, 2016 06:39
Show Gist options
  • Save jostyee/2258dc61a6a6c12f6188eb35551def3f to your computer and use it in GitHub Desktop.
Save jostyee/2258dc61a6a6c12f6188eb35551def3f to your computer and use it in GitHub Desktop.
#!/bin/sh
if [ -z $1 ]
then
echo "Usage: ./dl-slideshare.sh URL"
echo "Example: ./dl-slideshare.sh http://www.slideshare.net/bbaskin/malware-intelligence"
exit 1
fi
savepath="/tmp/slideshare"
if [ ! -d "$savepath" ]
then
mkdir $savepath
fi
path=`pwd`
name=`echo $1 | grep -Eoi '/[a-zA-Z0-9-]+$' | cut -d/ -f 2`
##### Create image url
listurl=`curl $1 | grep -Eoi 'data-full.*http://image.slidesharecdn.com/.*1024.jpg\?cb=[0-9]+' | cut -d\" -f 2`
cd $savepath
##### Loop Download List Picture
fn=100
for i in $listurl
do
((fn++))
`wget -O $fn.jpg $i`
done
#### Convert all picture to pdf
convert `ls -v` $path/$name.pdf
rm $savepath/*
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment