Download All Documents from Blackboard’s Digital Dropbox

Blackboard sucks. This is the opinion shared by roughly 95% of faculty at my university. But this is what we have, and a crappy course management system is still better than no course management system. So we are stuck with it for the time being.

Most of the gripes about BB system concentrates around the Digital Dropbox feature which is both very convenient, and very annoying. It’s convenient for the students because they can easily submit their assignments from anywhere at any time. They simply log into blackboard, click on the appropriate course link, and upload the file. They don’t have to spend time printing their work, they do not need to search for instructors email, and hope the spam filter won’t snag it. They just hit a button and they are done.

It is horribly annoying because the instructor does not have any control over how the uploads are organized. When you open the instructors view of the dropbox you see a long list of download links in reverse chronological order (newest entries are on the top). There is no way to tag or categorize assignments so unless students name their files appropriately you have to open each file to figure out what it is.

But most annoying feature is probably the fact that there is no way to download all the files from the dropbox at once. You can only grab them one at a time by clicking the links. You’d think there was a button that says “download all” but there is none. I think there is silly trick some people use that deals with exporting/archiving the course but it’s not exactly what you’d want to do every week unless you have to. So I decided to create a solution that would let me easily download all the files from the dropbox at a click of a button. How? Observe:

use strict;
use WWW::Mechanize;
use MIME::Base64;
 
 
my $bb_login_url = 'http://school.blackboard.com/webapps/login/?action=relogin';
my $bb_dropbox_url = 'http://school.blackboard.com/bin/common/dropbox.pl?action=LIST&course_id=_SOME_NUMBER_1&render_type=EDITABLE';
 
my $bb_user = 'your_username';
my $bb_passwd = 'your_password';
 
# where do you want the downloaded files
my $folder = "absolute_path";
 
# log into bb
my $browser = WWW::Mechanize->new(autocheck => 1, quiet => 0);
$browser->get($bb_login_url);
$browser->form_number(1);
$browser->field('user_id', $bb_user);
$browser->field('encoded_pw', encode_base64($bb_passwd));
$browser->click();
 
# go to dropbox
$browser->get($bb_dropbox_url);
 
# grab all the links
my @l = $browser->links;
 
my $i = 1;
 
foreach (@l)
{
	# the links to files have the word uploads in the uri
	if($_->url() =~ m/uploads/)
	{	
		print $i . "--" . substr($_->url(), rindex($_->url(), '/')+1) . "\n";
		$browser->get($_->url(), ":content_file" => $folder . $i . "--" . substr($_->url(), rindex($_->url(), '/')+1));
		$i++;
	}
}

I could do this in less than 10 lines probably but we are not playing perl-golf here. You will need to hard code the appropriate URL’s. I hope you can figure out how to get them. If not, you should not be fucking around with perl. In fact, step away from the computer right now. These things can explode if you press the wrong key combination!

I guess the important bit of information here is the regex inside of the loop. The whole thing works because the URL’s for the files inside the dropbox (at least in the version of bb we use) look like this:

http://school.blackboard.com/courses/1/COURSE_ID/uploads/_SOMENUMBER_1  /somefile.doc

None of the other links on the page have the word uploads anywhere in the URL so this is how we can isolate the download links regardless of what type of files they are. The get() method of WWW::Mechanize can fetch the specified URI into a file instead of memory if you pass in “:content_file” => “desired_file_name_and_path” as the second argument.

I’m appending a number to the output file name because it is not uncommon to find 2 files with the same name (for example homework1.zip or something like that). The get method will overwrite files without warning so the sequential numbers prevent that from happening. They also help to organize files to match them up with the blackboard page. If your students do not include their name inside of the file, you can look back on the dropbox page and figure out which file was it rather easily.

To delete all the files from dropbox simply change the inner loop to this:

foreach (@l)
{
	if($_->url() =~ m/=REMOVE/)
	{	
		$browser->get(substr($_->url(), rindex($_->url(), '/')+1));
	}
}

Here we are grabbing the links that have the word REMOVE in the link. So now you can fetch the whole dropbox and delete everything from it for a clean start.

I’m not sure if anyone will find this useful, but it really makes working with BB a tiny little bit less annoying for me.

Related Posts:

  • Using CPAN version of WWW::Mechanize with ActiveState Perl on Windows
  • Using Dropbox without Gnome
  • Blackboard Gradebook Sucks
  • WTF University Meets Blackboard
  • Tech Support Woes
  • SSL on Blackboard
  • How good are Digital Pens?
  • Legal Digital Music Services at Universities Suck
  • Firefox Freezing up When Downloading Files
  • Cory Doctorow is the Man

  • 10 Responses to “Download All Documents from Blackboard’s Digital Dropbox”

    1. Gravatar Vurlix CANADA Says: Reply to this comment

      Perhaps you should look into this Firefox extension which and I believe does what you need more conveniently:
      http://www.downthemall.net/

      I strongly recommend the beta 1.0b2 — it works great.

      Posted using Mozilla Firefox Mozilla Firefox 2.0.0.11 on Mac OS Mac OS X
    2. Gravatar Luke Maciak UNITED STATES Says: Reply to this comment

      Yeah, I used downthemall before but I forgot about it. Thanks for spoiling my fun here. ;P

      Actually a small modification to my script will allow me to delete the files from BB dropbox after I downloaded them which helps to keep that damn thing clean and managable. I don’t think downthemall can do this.

      Posted using Mozilla Firefox Mozilla Firefox 2.0.0.9 on Ubuntu Linux Ubuntu Linux
    3. Gravatar Alphast NETHERLANDS Says: Reply to this comment

      Blackboard is indeed pretty outdated and flawed. I still don’t know how they managed to become a sort of standard within course management system/ e-learning system? I remember TWT (from the ESB of Porto) was pretty ok, but I don’t know if they still develop it. I think the guys at Laval University in Montréal also designed something very nice.

      Here is another one which is pretty good: http://www.threeships.com/ ; Too bad they don’t have an English version of the website though.

      Posted using Mozilla Firefox Mozilla Firefox 2.0.0.11 on Ubuntu Linux Ubuntu Linux
    4. Gravatar Miloš UNITED STATES Says: Reply to this comment

      I agree with all of the assessments made above. Sadly this is another example of being “first” to market and acquiring your biggest competitor (WebCT) which was a much better product.

      It looks like we might be stuck to it for a while. I mean look at the URL: montclair.blackboard.com. WTF! Why is it hosted by them (I know why sadly and that might change soon) and even if it was hosted internally why do we have their brand name in the URL…why not just something like cms.montclair.edu (CMS = Course Management System) so that we can change our vendor without impacting user community.

      Posted using Mozilla Firefox Mozilla Firefox 2.0.0.11 on Windows Windows Vista
    5. Gravatar Luke Maciak UNITED STATES Says: Reply to this comment

      We used to host it, didn’t we? I remember that at one point the url was blackboard.montclair.edu. That was long time ago when I was a sophomore (or something like that). I do not remember using blackboard my freshman year.

      Btw, I really think you guys should register cms.montclair.edu and point it at montclair.blackboard.com. In fact I’m surprised it hasn’t been done yet. )

      Btw - out of curiosity: how much storage space do we actually have with blackboard? I’m pretty sure it would be much cheaper to set up a local server with twice the amount of storage including backup and maintenance costs. It would be pile of money up front, but it would pay for itself in few semesters probably. And, you know - put it behind SSL for example. But then again, what do I know. mrgreen

      Posted using Mozilla Firefox Mozilla Firefox 2.0.0.9 on Ubuntu Linux Ubuntu Linux
    6. Gravatar Miloš UNITED STATES Says: Reply to this comment

      Luke Maciak said:

      We used to host it, didn’t we?

      …and hopefully we will again very soon.

      Luke Maciak said:

      Btw, I really think you guys should register cms.montclair.edu and point it at montclair.blackboard.com. In fact I’m surprised it hasn’t been done yet. )

      you and I both. Btw, it’s an OIT “controlled” service. (

      Luke Maciak said:

      Btw - out of curiosity: how much storage space do we actually have with blackboard?

      As far as I know, it’s incremental, not fixed, so it increases as we need it as long as it is reasonable.

      Posted using Mozilla Firefox Mozilla Firefox 2.0.0.11 on Windows Windows Vista
    7. Gravatar Andy UNITED STATES Says: Reply to this comment

      Is there any problem with deleting the subdirectories under the drop box? Are there any references to these links in the database that will be hosed once the directory and file are deleted?

      Posted using Mozilla Firefox Mozilla Firefox 2.0.0.12 on Mac OS Mac OS X
    8. Gravatar Randy UNITED STATES Says: Reply to this comment

      Take a look at moving over to Moodle or Sakai. Both Open Source and free. Will save your university a ton of money. Lots of 3rd party integrations. I have been using Moodle for years. check it out.

      Posted using Mozilla Firefox Mozilla Firefox 2.0.0.14 on Windows Windows XP
    9. Gravatar Luke Maciak UNITED STATES Says: Reply to this comment

      Andy said:

      Is there any problem with deleting the subdirectories under the drop box? Are there any references to these links in the database that will be hosed once the directory and file are deleted?

      I’m sure we would. But rolling out a new service on my own, while the university as a whole is committed to blackboard and students already know how to use it, is probably counterproductive.

      Posted using Mozilla Firefox Mozilla Firefox 2.0.0.14 on Ubuntu Linux Ubuntu Linux
    10. Gravatar Seth UNITED STATES Says: Reply to this comment

      Neat perl trick, and certainly suitable to perl ninjas, but for techno-weenies like myself there’s a much easier solution: Downthemall!, an easy to use plugin for Firefox.

      Install it, navigate to blackboard, right click. Easy as pie.

      Posted using Mozilla Firefox Mozilla Firefox 2.0.0.14 on Windows Windows XP

    Leave a Reply

    XHTML: You can use these tags: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <code> <pre lang=""> <em> <i> <strike> <strong>

    [Quote selected]