From 96cc79111cc32a2268c231475f9795e5dc452a91 Mon Sep 17 00:00:00 2001 From: tv Date: Sat, 2 Nov 2013 13:20:18 +0100 Subject: vvs.de: import from the past --- util/bin/vvs.de | 35 +++++++++++++++++++++++++++++++++++ 1 file changed, 35 insertions(+) create mode 100755 util/bin/vvs.de (limited to 'util/bin/vvs.de') diff --git a/util/bin/vvs.de b/util/bin/vvs.de new file mode 100755 index 00000000..be9b9f14 --- /dev/null +++ b/util/bin/vvs.de @@ -0,0 +1,35 @@ +#! /bin/sh +set -euf + +#
+ #s/itdDateDay=/&${3-$itdDateDay}/ + #s/itdDateMonth=/&${4-$itdDateMonth}/ + #s/itdDateYear=/&${5-$itdDateYear}/ + +vvs_tmp=/tmp/vvs.tmp +curl -Ss http://www.vvs.de/fahrplan/ | +sed -rn "//,//{ + s.*.*\1=\2;T + /itdTripDateTimeDepArr=arr/b + s/(name_origin=).*/\1${1-$name_origin}/ + s/(name_destination=).*/\1${2-$name_destination}/ + ${3+s/(itdTimeHour=).*/\1${3-$itdTimeHour}/} + ${4+s/(itdTimeMinute=).*/\1${4-$itdTimeMinute}/} + p +}" | tr '\n' '&' | sed 's/&$//' >"$vvs_tmp" + + +#while read line ; do +# test -z "$line" || echo "$line" +#done >"$vvs_tmp" + +echo from: ${1-$name_origin} +echo \ \ to: ${2-$name_destination} +echo '-------------------------------------' +w3m -cols 9423 -post "$vvs_tmp" \ + -dump http://www.vvs.de/./efaanyfield/anyfield.php | +sed -rn " + s/^ +[0-9]+ +([0-9]+:[0-9]+) +([0-9]+:[0-9]+) +([A-Z0-9 ,]+) .*$/\1 \2 \3/p +" | tr -d , + +#### -- cgit v1.2.3 From acfa69aed25dcf27fae1550bb9c510f88c8cdd98 Mon Sep 17 00:00:00 2001 From: tv Date: Sat, 2 Nov 2013 14:53:41 +0100 Subject: *vvs.de: add some basic documentation --- util/bin/vvs.de | 26 ++++++++++++++++++++++++++ 1 file changed, 26 insertions(+) (limited to 'util/bin/vvs.de') diff --git a/util/bin/vvs.de b/util/bin/vvs.de index be9b9f14..718f34ce 100755 --- a/util/bin/vvs.de +++ b/util/bin/vvs.de @@ -1,4 +1,30 @@ #! /bin/sh +# +# NAME +# vvs.de - web scraper for VVS departure information +# +# SYNOPSIS +# vvs.de ORIGIN DESTINATION +# +# EXAMPLES +# $ vvs.de Hauptbahnhof Renningen +# +# CAVEATS +# Acceptable operands have to be found by trial and error. +# +# BUGS +# Probably bit rot.^_^ +# +# SEE ALSO +# mobile.vvs.de +# +# COPYRIGHT +# All departure information is copyrighted by Verkehrs- und +# Tarifverbund Stuttgart GmbH. The original copyright statement can +# be obtained online at http://www.vvs.de/impressum . +# +# The following code is your fault. +# set -euf # -- cgit v1.2.3 From 770f0329cd762cbba6b3b24fc37829e9768c6f1f Mon Sep 17 00:00:00 2001 From: tv Date: Mon, 4 Nov 2013 18:11:50 +0100 Subject: vvs.de: talk about hours and minutes --- util/bin/vvs.de | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'util/bin/vvs.de') diff --git a/util/bin/vvs.de b/util/bin/vvs.de index 718f34ce..3b7ccf93 100755 --- a/util/bin/vvs.de +++ b/util/bin/vvs.de @@ -4,10 +4,10 @@ # vvs.de - web scraper for VVS departure information # # SYNOPSIS -# vvs.de ORIGIN DESTINATION +# vvs.de ORIGIN DESTINATION [HH [MM]] # # EXAMPLES -# $ vvs.de Hauptbahnhof Renningen +# $ vvs.de Hauptbahnhof Renningen 13 37 # # CAVEATS # Acceptable operands have to be found by trial and error. -- cgit v1.2.3