scripts/fetch_gaidao.sh

17 lines
608 B
Bash
Raw Normal View History

2018-06-11 07:04:27 +02:00
#!/bin/sh
2019-07-02 19:24:36 +02:00
# Auf neue Ausgaben von der Gai Dao prüfen, herunterladen
2018-06-11 07:04:27 +02:00
2019-07-02 19:24:36 +02:00
cd ~/Documents/Zeitungen/Gaidao || exit 1
ausgaben=$(curl -s https://fda-ifa.org/gaidao/ausgaben/ \
| grep -Eo 'https://fda-ifa.org/gai-?dao-(n[or]-)?[0-9]+-[^/]*/')
2018-06-11 07:04:27 +02:00
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 [ -n "${file}" ] && [ ! -e "${file}" ]; then
2019-07-02 19:24:36 +02:00
echo "Downloading Gai Dao: ${file}."
curl -so "${file}" "${url}"
2019-07-02 19:24:36 +02:00
fi
2018-06-11 07:04:27 +02:00
done