PasteSite is open to the public, but with limited features. Register to be able to modify access rights, track your pastes and more...
If you prefer reading light text on a dark background to dark text on a light background, then you might want to try the dark theme.
"Untitled" by Anonymous [Python]Actions: |
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 |
#!/usr/bin/python import urllib, urllib2 import re url = 'http://www.dme.rwth-aachen.de/lehre/ergebnisse?pruefungsid=76' file = open('datuebungen.sql', 'w') file.write('INSERT INTO datuebungen (matrikel, uebung, aufgabe, punkte) VALUES') ids = [242934, 242964, 243660, 244282, 244937, 245399, 248546, 249286, 251196, 251829, 253937, 256069, 256102, 257867, 258853, 259100, 259343, 259385, 260073, 260661, 261378, 262121, 262294, 262860, 262999, 263110, 263151, 263631, 264622, 265043, 265235, 265458, 265595, 266203, 266260, 266362, 267067, 267556, 267568, 267727, 269320, 269456, 269570, 269800, 269921, 270556, 270620, 270667, 271746, 272153, 273801, 273821, 273889, 274693, 275172, 275305, 275394, 275637, 276005, 276677, 276792, 276797, 277013, 277058, 277115, 277630, 277662, 278014, 278351, 279006, 279029, 279087, 279118, 279185, 279361, 279536, 279555, 279564, 279567, 279942, 279998, 280019, 280365, 280403, 280762, 280911, 281109, 281138, 281189, 281203, 281231, 281238, 281380, 281424, 281516, 281773, 282037, 282041, 282121, 282193, 282325, 282645, 282682, 282944, 283010, 283095, 283132, 283277, 283299, 283329, 283382, 283399, 283584, 283741, 283863, 283994, 283996, 284000, 284004, 284019, 284435, 284472, 284483, 284487, 284567, 285004, 285044, 285317, 285343, 285411, 285427, 285537, 286130, 286132, 286140, 286151, 286164, 286205, 286212, 286270, 286407, 286409, 286427, 286430, 286441, 286453, 286456, 286471, 286717, 286963, 287181, 287189, 287193, 287200, 287205, 287244, 287257, 287268, 287269, 287291, 287302, 287324, 287331, 287359, 287360, 287367, 287372, 287374, 287393, 287394, 287413, 287447, 287470, 287494, 287508, 287509, 287538, 287547, 287549, 287568, 287574, 287594, 287610, 287652, 287668, 287684, 287706, 287726, 287738, 287746, 287760, 287780, 287785, 287803, 287813, 287867, 287870, 287886, 287888, 287911, 287914, 287919, 287924, 287926, 287937, 287939, 287943, 287944, 287946, 287947, 287961, 287968, 287981, 287986, 288016, 288022, 288030, 288034, 288144, 288165, 288188, 288229, 288249, 288266, 288612, 288649, 288745, 288779, 288840, 288865, 288870, 288875, 288877, 288884, 288911, 288922, 288926, 288941, 288948, 288958, 288964, 288974, 288982, 289011, 289031, 289044, 289053, 289058, 289077, 289089, 289090, 289104, 289111, 289155, 289213, 289269, 289273, 289297, 289308, 289312, 289347, 289381, 289405, 289428, 289431, 289441, 289457, 289490, 289502, 289503, 289549, 289558, 289777, 289815, 289816, 289817, 289894, 289899, 289912, 290013, 290031, 290035, 290038, 290279, 290303, 290305, 290309, 290328, 290333, 290344, 290345, 290349, 290352, 290354, 290363, 290368, 290394, 290403, 290414, 290472, 290477, 290485, 290493, 290509, 290510, 290526, 290582, 290615, 290635, 290659, 290689, 290712, 290729, 290734, 290756, 290839, 290972, 291122, 291311, 291376, 291453, 291464, 291483, 291717, 291722, 292052, 292055, 292091, 292165, 292246, 292268, 292287] for matrikel in ids: try: data = urllib.urlencode({'Matrikelnummer' : matrikel}) req = urllib2.Request(url, data) response = urllib2.urlopen(req) content = response.read() except Exception, detail: print detail matches = re.finditer("bung ([0-9]+) - ([0-9])+</td><td align='right'>([0-9]+) / ([0-9]+)</td>", content) hadSomething = False for uebung in matches: nummer = uebung.group(1) aufgabe = uebung.group(2) punkte = uebung.group(3) file.write('\n(%s, %s, %s, %s),' % (matrikel, nummer, aufgabe, punkte)) hadSomething = True if hadSomething: print 'Got data from %d!' % matrikel file.truncate(file.tell() - 1) file.close() |