Commit 10cb9ea1 authored by Thomas Tsiakalakis's avatar Thomas Tsiakalakis

Update download.sh

parent 838e96f6
......@@ -10,6 +10,7 @@ limitmonth='0' # 0 = no limit
set -e
tmpdir=$(mktemp -d)
currentdir=$(realpath $(dirname $0))
echo -n 'Loggin in.'
widgetUrl=$(curl -s https://rap.real.de/endpoints.js | grep 'samlIframe' | sed -re 's/.*"samlIframe":"([^"]+)".*/\1/g' | sed -e 's#\\##g')
......@@ -49,13 +50,13 @@ echo 'fetching '$(wc -l ${tmpdir}/bonids.txt | awk '{ print $1 }')' receipts...'
mkdir -p ${downloadpath}
while read bonid; do
echo -n ' '${bonid}.pdf
filename="$(date +%Y%m%d%H%M%SZ) - real - ${bonid} - Rechnung.pdf"
if [ -f "${downloadpath}/${filename}" ]; then
if [ $(grep ${bonid} ${tmpdir}/bonids.txt) ]; then
echo ' SKIPPING'
else
echo -n ' DOWNLOADING'
curl -s --cookie ${tmpdir}/cookies.txt -o "${downloadpath}/${filename}" 'https://www.real.de/online-kassenbons/meine-einkaeufe/?type=201807041728&no_cache=1&bonid='${bonid}
curl -s --cookie ${tmpdir}/cookies.txt -o "${bonid}.pdf" 'https://www.real.de/online-kassenbons/meine-einkaeufe/?type=201807041728&no_cache=1&bonid='${bonid}
echo ' OK'
echo ${bonid} >> ${currentdir}/.archive
fi
done < ${tmpdir}/bonids.txt
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment