Last active
September 4, 2021 21:44
-
-
Save eyJhb/2d45f95940b871a0c10691e73c13b8e6 to your computer and use it in GitHub Desktop.
Schedule finder for AAU
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env bash | |
START=6100 | |
KEYWORD=$1 | |
for i in {1..2000}; do | |
if [ $(($i%100)) -eq 0 ]; then | |
echo "Currently at: $i" | |
fi | |
TITLE=$(curl --silent "https://www.moodle.aau.dk/calmoodle/public/?sid="$i | grep -E '<h1 class="aalborg_title">' | sed -E 's/\W+<h1 class="aalborg_title">Schedule for ([^\<]+)?<\/h1>/\1/g' | tr -d \\n) | |
if [ "$KEYWORD" == "" ]; then | |
if [ "$TITLE" != "" ]; then | |
echo "$i - $TITLE" | |
fi | |
else | |
echo $TITLE | grep -i $KEYWORD > /dev/null 2>&1 | |
if [ $? -eq 0 ]; then | |
echo "$i - $TITLE" | |
fi | |
fi | |
done |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import requests | |
from bs4 import BeautifulSoup | |
start = 4533 | |
for x in range(0,2000): | |
if x % 100 == 0: | |
print("At - "+str(start+x)) | |
req = requests.get("https://www.moodle.aau.dk/calmoodle/public/?sid="+str(x+start)) | |
bs = BeautifulSoup(req.text, "lxml") | |
title = bs.find("h1", {"class": "aalborg_title"}) | |
if not title: | |
print("Could not find title: "+str(x+start)) | |
continue | |
title = title.getText() | |
title = title.lower() | |
if "ark" in title or "urb" in title or "bsc" in title: | |
print("Found - "+str(x+start)+" - "+title) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment