summaryrefslogtreecommitdiff
path: root/elektrichki.sh
blob: ba8016a4bda61145dd41ecb07cc5d300058d4c0a (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
#!/bin/sh
apikey=$(pass show yandex.ru_Z_api|awk '/^API_KEY/ {print $2}')
from_station=$(pass show personal_address|awk '/^from_station/ {print $2}')
to_station=$(pass show personal_address|awk '/^to_station/ {print $2}')
dt=$(dateadd $(date --iso-8601) +1d)
url="https://api.rasp.yandex.net/v3.0/search/"
url=${url}"?transport_types=suburban&format=json&lang=ru_RU"
url=${url}"&from=${from_station}&to=${to_station}&date=${dt}"
printf "%s:\n" "$dt"
#cat /tmp/rasp.json |
curl --silent --show-error --header "Authorization: $apikey" $url |
	jq --monochrome-output --compact-output --raw-output '.segments[] |
		[.from.title, (.departure|.[11:16]), (.arrival|.[11:16]), .to.title]|@tsv'