From ecb28155a6afcbe4c50ebe8e6bc112ff884af48a Mon Sep 17 00:00:00 2001 From: Clay Smith Date: Tue, 1 Aug 2023 01:01:56 -0500 Subject: First commit --- curl_iowastate.sh | 20 ++++++++++++++++++++ 1 file changed, 20 insertions(+) create mode 100755 curl_iowastate.sh (limited to 'curl_iowastate.sh') diff --git a/curl_iowastate.sh b/curl_iowastate.sh new file mode 100755 index 0000000..6fbcaf9 --- /dev/null +++ b/curl_iowastate.sh @@ -0,0 +1,20 @@ +#/bin/bash + +IFS=$"," + +declare -a buildings=( $(curl -s https://www.fpm.iastate.edu/maps/buildings/ | awk '/var buildingNames/{ f = 1; next } /];/{ f = 0 } f' | tr -d '"' | tr ' ' '+') ) + +URL="https://www.fpm.iastate.edu/maps/buildings/building.asp?building=" + +echo "" > /tmp/building_urls.txt +for ((i = 0; i < ${#buildings[@]}; ++i)) +do + printf "$URL${buildings[i]}\n" >> /tmp/building_urls.txt +done + +if [ "$1" = "reload" ]; then + echo "" > /tmp/building_html_time.txt + parallel curl -s {} < /tmp/building_urls.txt | grep "mt-3\|Monday" >> /tmp/building_html_time.txt +fi + +cat /tmp/building_html_time.txt | grep "mt-3\|tr.*th>" | grep "Monday" -B1 | sed -e 's/--//g' -e 's/

/\n/g' -e 's/<\/h2>//g' -e 's///g' -e 's/<\/th>/ /g' -e 's/<\/td>/ /g' -e 's/<\/tr>//g' | tee times.txt -- cgit v1.2.1