Skip to content

Instantly share code, notes, and snippets.

@danielepolencic
Created April 23, 2012 16:02
Show Gist options
  • Save danielepolencic/2471903 to your computer and use it in GitHub Desktop.
Save danielepolencic/2471903 to your computer and use it in GitHub Desktop.
Workaround for disabled download button on SlideShare [www.coconutmonarchy.com]
#!/bin/bash
if [ -z "$1" ]; then
echo "";echo "[i] Usage: `basename $0` http://www.slideshare.net/link_with_presentation";echo "";exit
fi
presentation=`curl -s --user-agent 'Mozilla/5.0' "$1" | tr '"' "\n" | egrep -m 1 -e "static\.slidesharecdn\.com\/swf\/ssplayer2\.swf\?doc=(.*?)\{rel}{startSlide}" | cut -d '{' -f 1 | cut -d '=' -f 2`
pages=`curl -s --user-agent 'Mozilla/5.0' "$1" | grep -m 1 "slideshare_object" | sed 's/.*total_slides":\([^,]*\).*/\1/'`
version=`curl -s --user-agent 'Mozilla/5.0' "$1" | grep -m 1 "slideshare_object" | sed 's/.*version_no":"\([^""]*\).*/\1/'`
# check if swfrender (swftools) exists.
hash swfrender 2>&- || { echo >&2 "I require swfrender (package swftools) but it's not installed. Aborting."; exit 1; }
# check if convert (imagick) exists.
hash convert 2>&- || { echo >&2 "I require convert (package imagick) but it's not installed. Aborting."; exit 1; }
rm slide.pdf >/dev/null 2>&1
rm -r tmp >/dev/null 2>&1
mkdir tmp
for ((i = 1; i <= $pages; i++));
do
link="http://cdn.slidesharecdn.com/$presentation-slide-$i.swf?ver=$version"
slide=`printf "tmp/slide-%03d.swf" $i`
echo "$link"
# echo $slide
curl -s --user-agent 'Mozilla/5.0' $link --O $slide
swfrender $slide -o "$slide.png"
done
echo "Combining the slides together..."
convert tmp/*.png slide.pdf
# rm -r tmp >/dev/null 2>&1
@Informer
Copy link

Informer commented Oct 5, 2013

how do I use this??

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment