scripts/fetch_gaidao.sh

17 lines
464 B
Bash
Executable File

#!/bin/sh
# Auf neue Ausgaben von der Gai Dao prüfen, herunterladen
cd ~/Documents/Zeitungen/Gaidao || exit 1
ausgaben=$(curl -s https://fda-ifa.org/gaidao/ausgaben/ \
| grep -Eo 'https://fda-ifa.org/[^"]*\.epub' \
| head -n 5)
for url in ${ausgaben}; do
file=$(basename "${url}")
if [ -n "${file}" ] && [ ! -e "${file}" ]; then
echo "Downloading Gai Dao: ${file}."
curl -so "${file}" "${url}"
fi
done