Perl script to suck courses files
Posted on September 30th, 2003 by Sacha Chua
Back when I didn’t have a Download as Archive in the courses system, I
used this script to suck all the files.
#!/usr/bin/perl use English; $SESSIONID = $ARGV[0]; open INDEX, "curl -b PHPSESSID=$SESSIONID 'http://courses.ateneo.edu/submit/index.php?project_id=$ARGV[1]' |"; while (($s =) && ($s !~ /select name="login"/)) { } my @logins; my @lnames; my @fnames; my $i = 0; while ( =~ /option value="(\w+)"> (.+?), (.+?)) { $logins[$i] = $1; $lnames[$i] = $2; $fnames[$i] = $3; $i++; } while (($s = ) && ($s !~ /smaller/)) { } my $login; my $timestamp; while ($s = ) { if ($s =~ / (\w+?)) { $login = $1; ; # skip name ; # skip email ; # skip first part; if ( =~ /^\s*(.+?)\s*$/) { $timestamp = $1; } ; # skip ; # skip ; # skip } elsif ($s =~ /nbsp/) { # $s nbsp; ; # td valign = top ; # files while (($s = ) && ($s =~ /index\.php\?project_id=(\d+)\&login=(\w+)\&file=(.+?)\"/)) { mkdir $1; mkdir "$1/$2"; system "curl -b PHPSESSID=$SESSIONID 'http://courses.ateneo.edu/submit/index.php?project_id=$1&login=$2&file=$3' -o $1/$2/$3"; } } elsif ($s =~ /html/) { close INDEX; exit; } } Short URL: http://sachachua.com/blog/p/1185 On This Day...
- 2012: Sketchnotes from WordCamp Toronto 2012 Day 2: Case studies — Click on the images for larger version. Please feel free to share these! You can credit it as © 2012 [...]
- 2011: Converted my Arduino foot pedal into a Teensy foot pedal! — Look at how neat my foot pedal looks now! It’s much better than my dangling-wires prototype with the Arduino. At [...]
- 2010: Book: How to Win Every Argument: The Use and Abuse of Logic — Photo (c) 2008 Simon Peckhan – Creative Commons Attribution 2.0 Licence Madsen Pirie (2006) London: Continuum International ISBN: 0826490069 [...]
- 2009: Entrepreneurship tips from Sarah Prevette (Sprouter) at the Toronto Girl Geek Dinner — Last night’s Toronto Girl Geek Dinner with Sarah Prevette, the founder ofSprouter, was a great braindump of entrepreneurship and networking [...]
- 2009: Working around networking weaknesses and playing to strengths — Yesterday taught me a little more about my quirks when it comes to connecting with people. First: I’m horrible at matching [...]
- 2008: Dan Pink — Dan Pink gave a presentation on Johnny Bunko: The Medium and The Message. There’s plenty to write about, but let [...]
- 2008: Knowledge [shared] is power — Here’s an excerpt from Aaron Kim’s blog post about meritocracy and social media: Furthermore, Web 2.0 and Social Media are leveling [...]
- 2007: Weekly review — Slow and steady progress on my Emacs book – 2351 words so far. I should find a way to accelerate. Maybe [...]
- 2006: Sorting things out — Many many many thanks to Dan and Jed for coming over, reassuring me, and helping me sort things out. Warm and [...]
- 2006: Capsule summary — Was propositioned over dinner last night by someone whom I had hoped would be a good mentor and friend. Firmly said [...]
- 2006: Panic stop — If I’ve invited you to do something today, please accept my apologies and last-minute cancellation. I am currently in no condition [...]
- 2005: On boycotts and lower gas prices — I received a forwarded e-mail exhorting Filipinos to boycott Shell and Caltex in order to force the two companies to lower [...]
- 2005: Watched improv comedy — Bill Thanis of the Toronto Linux Users Group invited me to the pay-what-you-can improv comedy show at Bad Dog Theatre. It [...]
- 2004: Long live open source — Just got two e-mailed patches to tla2darcs, a tool I wrote a few months ago (but have since then forgotten). =) [...]
- 2003: “How Do We Tell Truths That Might Hurt”? — http://www.cs.virginia.edu/~evans/cs655/readings/ewd498.html
- 2003: Composing messages in Gnus with elisp — emacs — (require 'gnus-msg) (defun dxr-group-mail (To Subject) "Start composing a mail." (interactive) (gnus-setup-message 'message (message-mail To Subject)))
- 2003: Code for inserting student code — (defvar sacha/project-base-path nil "*The path to the project files, excluding the ending /") (defun sacha/insert-student-files (id) (interactive "MID: ") [...]
- 2003: More past entries — - 2002.06.20 - 2002.06.25 - 2003.02.02 - 2003.01.12 - 2003.01.13 - 2003.12.27
- 2003: Hello world, school, teaching, games — blast from the past — From my 2002.06.20 entry: 12:52 AM on a schoolday that starts at 10:30 AM is probably not the best time to write [...]
I'm 


