Alexander-Merlos
Alexander-Merlos

Reputation: 11

How to use wget or another command to download files from my university blackboard?

Hello I have tried using wget to download class files from BlackBoard, but it keeps saying that

Reusing existing connection to uic.blackboard.com:443. HTTP request sent, awaiting response... 401

Username/Password Authentication Failed.

I may be using the command wrong. I would appreciate the help

I have tried wget and curl.

Upvotes: 0

Views: 2075

Answers (2)

Noscere
Noscere

Reputation: 419

The page you are trying to open uses javascript, which is not supported by wget - so that's the end of that option.

As for curl, what happens if you try to spoof javascript support (this may end up dumping the page source, which may not be what you are trying to achieve, but worth trying)

The following call to curl is setting the user agent so that it appears to be a javascript compatible browser, and we are also explicitly stating HTTPS protocol (even though 443 implies it, best to be clear our intentions):

    curl -L -v "https://uic.blackboard.com:443" -A "Mozilla/5.0 (compatible; MSIE 7.01; Windows NT 5.0)"

EDIT: As mentioned by @Bruce Malaudzi even if you can get around the Javascript problem, there is also the authentication error, so modified my answer to include that too:

    # basic authentication (your PWD is going to be saved
    # in console history so be careful here):
    curl -L -v "https://uic.blackboard.com:443" \
        -A "Mozilla/5.0 (compatible; MSIE 7.01; Windows NT 5.0)" \
        --user USERNAME:PASSWORD
    # OAuth2 authentication:
    curl -L -v "https://uic.blackboard.com:443" \
        -A "Mozilla/5.0 (compatible; MSIE 7.01; Windows NT 5.0)" \
        -H "Authorization: OAuth <YOUR_TOKEN_STRING>"

Upvotes: 1

Bruce Malaudzi
Bruce Malaudzi

Reputation: 456

HTTP 401 error means authorization error. You can pass authentication details through wget or curl. Please note that passing credentials directly on the terminal may lead to accidental leakage.

For basic authentication:

curl --user YOUR-USERNAME:YOUR-PASSWORD http://www.example.com
wget --user YOUR-USERNAME --password YOUR-PASSWORD http://example.com/

For oAuth-2.0 authentication:

curl -H "Authorization: OAuth <ACCESS_TOKEN>" http://www.example.com

Upvotes: 1

Related Questions