Updated fetch_gaidao.sh.

This commit is contained in:
tastytea 2019-07-02 19:24:36 +02:00
parent 0f6c2b6a99
commit 2a203c0636
Signed by: tastytea
GPG Key ID: CFC39497F1B26E07
1 changed files with 10 additions and 10 deletions

View File

@ -1,16 +1,16 @@
#!/bin/sh
# Auf neue Ausgaben von der Gai Dao prüfen, herunterladen.
# Auf neue Ausgaben von der Gai Dao prüfen, herunterladen
cd ~/Documents/Zeitungen/Gaidao
cd ~/Documents/Zeitungen/Gaidao || exit 1
ausgaben="$(curl -s https://fda-ifa.org/gaidao/ausgaben/ \
| grep -Eo 'https://fda-ifa.org/gai-?dao-(nr-)?[0-9]+-[^/]*/')"
| grep -Eo 'https://fda-ifa.org/gai-?dao-(n[or]-)?[0-9]+-[^/]*/')"
for ausgabe in ${ausgaben}; do
url="$(curl -s ${ausgabe} \
| grep -Eo 'https://fda-ifa.org/wp-content/uploads/[0-9]{4}/[0-9]{2}/[^ ]*\.epub')"
file="$(echo ${url} | grep -o '[^/]*\.epub')"
if [ ! -e ${file} ]; then
echo "Downloading Gai Dao: ${file}."
curl -so ${file} ${url}
fi
url="$(curl -s ${ausgabe} \
| grep -Eo 'https://fda-ifa.org/wp-content/uploads/[0-9]{4}/[0-9]{2}/[^ ]*\.epub')"
file="$(echo ${url} | grep -o '[^/]*\.epub')"
if [ ! -e ${file} ]; then
echo "Downloading Gai Dao: ${file}."
curl -so ${file} ${url}
fi
done