From 6e27103acde41a180d725b29a8f3e8be6025911c Mon Sep 17 00:00:00 2001 From: Phillip Berndt Date: Mon, 2 Feb 2015 08:39:10 +0100 Subject: Cyanide and Happiness fixed yet again --- bin/comics/cyanide | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) diff --git a/bin/comics/cyanide b/bin/comics/cyanide index cb20267..969a44d 100755 --- a/bin/comics/cyanide +++ b/bin/comics/cyanide @@ -16,25 +16,26 @@ export LANG=C export LC_ALL=C export LC_TIME=C year=`date -d "$daysago days ago 00:00:00" +%Y` -month=`date -d "$daysago days ago 00:00:00" +%B` +month=`date -d "$daysago days ago 00:00:00" +%m` day=`date -d "$daysago days ago 00:00:00" +%d` -part=`curl -s "http://explosm.net/comics/archive/$year/" | grep -oE "${month}.+" | sed -nre "s#.+href=\"([^\"]+)\">[^/]+${day}<.+#\1#p"` +part=`curl -s "http://explosm.net/comics/archive/$year/$month" | sed -nre "s#.+/comics/([0-9]+)\">$year.$month.$day.+#\1#p"` if [ -z "$part" ]; then echo "Cyanide and Happyness: Kein Comic für $year, $month $day" rm -rf "${tmp}" exit fi -htmladdress="http://explosm.net/$part" +htmladdress="http://explosm.net/comics/$part" echo "Cyanide and happyness: $htmladdress gefunden" browser="Mozilla/4.06 [en] (X11; I; Linux 2.0.35 i586)" echo "Lese URL von $htmladdress" -url=$(wget ${wget_args} -O - --user-agent="$browser" "$htmladdress" | grep -oE 'http://www.explosm.net/db/files/Comics/[^"]+') +url=$(wget ${wget_args} -O - --user-agent="$browser" "$htmladdress" | grep -oE 'files.explosm.net/comics/[^"]+' | head -n1) -if [ -n $url ]; then +if [ -n "$url" ]; then + url="http://$url" echo "Dateiname: $url" echo "Hole cyanide and happyness für Datum: $(date -d"$daysago days ago" -I)" -- cgit v1.2.3-1-g7c22