fixups because I can't write;; Laura is very cute
parent
92c9e8b454
commit
8d38c55b53
|
@ -2,6 +2,6 @@
|
||||||
|
|
||||||
This is a (very) work-in-progress project; Currently, there are two messy scripts:
|
This is a (very) work-in-progress project; Currently, there are two messy scripts:
|
||||||
|
|
||||||
`./platform.sh "Warszawa Centralna"` - gives links to PKP's static timetable page, usually with platforms listed
|
`./platform.sh "Warszawa Centralna" "Opole Główne"` - gives links to PKP's static timetable page, usually with platforms listed
|
||||||
|
|
||||||
`./trains.sh "Opole Główne"` - lists trains that will stop on station in the next few hours
|
`./trains.sh "Łódź Widzew"` - lists trains that will stop on station in the next few hours
|
||||||
|
|
|
@ -16,5 +16,5 @@ detailsUrl=$(curl -s -c cookies.txt "https://rozklad-pkp.pl/pl/tp?queryPageDispl
|
||||||
|
|
||||||
echo "https://rozklad-pkp.pl$detailsUrl"
|
echo "https://rozklad-pkp.pl$detailsUrl"
|
||||||
echo ---
|
echo ---
|
||||||
curl -s -b cookies.txt -H "Cookie: NGINX1=ngnix11; NGINX=ngnix2;" "https://rozklad-pkp.pl$detailsUrl" | grep -Poh 'trainlink.*?"' | sed -s 's/\&/\&/g;s/\&\&/\&/g;s/trainlink/http\:\/\/rozklad-pkp.pl\/pl\/ti?&/g;s/&"$//g'
|
curl -s -b cookies.txt "https://rozklad-pkp.pl$detailsUrl" | grep -Poh 'trainlink.*?"' | sed -s 's/\&/\&/g;s/\&\&/\&/g;s/trainlink/http\:\/\/rozklad-pkp.pl\/pl\/ti?&/g;s/&"$//g'
|
||||||
rm cookies.txt
|
rm cookies.txt
|
||||||
|
|
|
@ -21,22 +21,15 @@ if [[ $(echo "$station" | grep -i "multiple") != '' ]]; then
|
||||||
echo "$station"
|
echo "$station"
|
||||||
exit 0
|
exit 0
|
||||||
fi
|
fi
|
||||||
echo $station | grep -Poh "^[^:]+"
|
|
||||||
|
|
||||||
url="http://infopasazer.intercity.pl/$(echo $station | grep -Poh "^[^:]+")"
|
url="http://infopasazer.intercity.pl/$(echo $station | grep -Poh "^[^:]+")"
|
||||||
|
|
||||||
data="$(curl $url | tr -d '\r' | tr -d '\n' | grep -Poh "<tr.*?</tr>")"
|
data="$(curl $url | tr -d '\r' | tr -d '\n' | grep -Poh "<tr.*?</tr>")"
|
||||||
|
|
||||||
IFS=$'\n'
|
IFS=$'\n'
|
||||||
trains=$(echo $data | grep -Poh '<a href=".*?">.*?<br/>.*?</a>')
|
trains=$(echo $data | grep -Poh '<a href=".*?">.*?<br/>.*?</a>')
|
||||||
|
|
||||||
|
|
||||||
links=($(echo $data | grep -Poh "\?p\=train&id\=[0-9]+"))
|
links=($(echo $data | grep -Poh "\?p\=train&id\=[0-9]+"))
|
||||||
names=($(echo "$trains" | grep -Poh ">.*<br/>.*</a>" | sed -s 's/<br\/>/ /g;s/<\/a>//g;s/^>//g'))
|
names=($(echo "$trains" | grep -Poh ">.*<br/>.*</a>" | sed -s 's/<br\/>/ /g;s/<\/a>//g;s/^>//g'))
|
||||||
|
|
||||||
for (( i=0; i<${#links[@]}; i++ )); do
|
for (( i=0; i<${#links[@]}; i++ )); do
|
||||||
#echo "${links[$i]} ---- ${names[$i]}"
|
|
||||||
echo ${links[$i]}: ${names[$i]}
|
echo ${links[$i]}: ${names[$i]}
|
||||||
done
|
done
|
||||||
|
|
||||||
# Numer pociągu | Przewoźnik | Data | Relacja | Przyjazd planowo | Opóźnienie
|
|
||||||
|
|
Loading…
Reference in New Issue