From bf9c16a46a3726cc2e528cf344c4af531c5082ae Mon Sep 17 00:00:00 2001 From: tastytea Date: Mon, 11 Jun 2018 07:04:27 +0200 Subject: [PATCH] added fetch_gaidao.sh --- README.md | 9 +++++---- fetch_gaidao.sh | 16 ++++++++++++++++ 2 files changed, 21 insertions(+), 4 deletions(-) create mode 100644 fetch_gaidao.sh diff --git a/README.md b/README.md index e169344..f272c41 100644 --- a/README.md +++ b/README.md @@ -1,4 +1,5 @@ -| Script | Description | -| ---------: |:-------------------------------------------------------------- | -| urlhandler | Open URLs based on regular expressions. | -| yt2mpd.sh | Adds an Youtube video to MPD, with correct title and duration. | +| Script | Description | +| --------------: |:-------------------------------------------------------------- | +| urlhandler | Open URLs based on regular expressions. | +| yt2mpd.sh | Adds an Youtube video to MPD, with correct title and duration. | +| fetch_gaidao.sh | Auf neue Ausgaben von der Gai Dao prüfen, herunterladen. | diff --git a/fetch_gaidao.sh b/fetch_gaidao.sh new file mode 100644 index 0000000..f07d1b0 --- /dev/null +++ b/fetch_gaidao.sh @@ -0,0 +1,16 @@ +#!/bin/sh +# Auf neue Ausgaben von der Gai Dao prüfen, herunterladen. + +cd ~/Documents/Zeitungen/Gaidao +ausgaben="$(curl -s https://fda-ifa.org/gaidao/ausgaben/ \ + | grep -Eo 'https://fda-ifa.org/gai-?dao-(nr-)?[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 +done