Commit 8d38c55b authored by Dominika Liberda's avatar Dominika Liberda 💽
Browse files

fixups because I can't write;; Laura is very cute

parent 92c9e8b4
......@@ -2,6 +2,6 @@
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 ---
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
......@@ -21,22 +21,15 @@ if [[ $(echo "$station" | grep -i "multiple") != '' ]]; then
echo "$station"
exit 0
fi
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>")"
IFS=$'\n'
trains=$(echo $data | grep -Poh '<a href=".*?">.*?<br/>.*?</a>')
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'))
for (( i=0; i<${#links[@]}; i++ )); do
#echo "${links[$i]} ---- ${names[$i]}"
echo ${links[$i]}: ${names[$i]}
done
# Numer pociągu | Przewoźnik | Data | Relacja | Przyjazd planowo | Opóźnienie
Supports Markdown
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