simple-slideshare-downloader/slideshare_dl.sh

50 lines
1.7 KiB
Bash
Raw Normal View History

2016-07-20 17:22:45 +02:00
#!/bin/bash
# Simple slideshare downloader
# By Daniil Gentili (https://daniil.it)
# Licensed under GPLv3
# Copyright 2016 Daniil Gentili
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation, either version 3 of the License, or
# (at your option) any later version.
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
# You should have received a copy of the GNU General Public License
# along with this program. If not, see <http://www.gnu.org/licenses/>.
echo "Simple slideshare downloader Copyright (C) 2016 Daniil Gentili.
This program comes with ABSOLUTELY NO WARRANTY; for details see
https://github.com/danog/git-reset-repo/blob/master/LICENSE.
This is free software, and you are welcome to redistribute it
under certain conditions: see https://github.com/danog/simple-slideshare-downloader/blob/master/LICENSE.
"
usage() {
echo "Usage: $0 URL"
exit
}
[ -z "$*" ] && usage
2016-08-20 19:57:46 +02:00
TOCONV=""
2016-07-20 17:22:45 +02:00
for f in $*;do
echo "Downloading $f..."
PAGE="$(curl -s "$f")"
2016-08-20 19:57:46 +02:00
URLS=$(echo "$PAGE" | sed '/data-normal/!d;s/.*data-normal="//;s/\s.*//g' | tr -s '\n' ' ')
TITLE=$(echo "$PAGE" | sed '/[<]title[>]/!d;s/.*[<]title[>]//g;s/[<]\/title[>].*//g')
mkdir "$TITLE"
for URL in $URLS;do
FNAME="$TITLE/"$(echo "$URL" | sed 's/\?.*//g;s/.*\///g')
curl -sL "$URL" -o "$FNAME"
TOCONV="$TOCONV $FNAME"
2016-07-20 17:22:45 +02:00
done
2016-08-20 19:57:46 +02:00
convert $TOCONV -gravity South -annotate 0 '%f' "$TITLE".pdf
echo "Saved in $TITLE.pdf, source images are in $TITLE/."
2016-07-20 17:22:45 +02:00
done
echo "Bye!"
exit