Created
January 18, 2012 00:30
-
-
Save melpomene/1630005 to your computer and use it in GitHub Desktop.
Find labb sign up page for Computer Science courses on LTH when teacher forgett to update links on course page...
This file contains 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 | |
import time | |
COURSE_NAME = "Kompilatorteknik" | |
""" Byt ut COURSE_NAME till kursen du letar efter. Botten crawlar sedan och hojtar till om den hittar din kurs labbanmälningsformulär. | |
Kommer även skriva ner datan till fil om ditt sökord inte fungerade och du vill kolla för hand. | |
GLÖM EJ ÄNDRA PATH TILL FILEN DU VILL SKRIVA TILL""" | |
f = open("/path/to/file/sites.txt", "a") | |
for i in range(400): | |
url = "https://sam.cs.lth.se/LabsSelectSession?occasionId=" + str(i) | |
print "Fetching " + url | |
f.write(url+"\n") | |
r = requests.get(url) | |
if COURSE_NAME in r.content: | |
print "FOUND COURSE IN: " + url | |
f.write(r.content + "\n") | |
time.sleep(0.3) # Be nice to DDG |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment