A simple Bash script that automates the downloading of course materials from the eClass platform, widely used by Greek universities.
- 📦 Download all materials using the "Download all as ZIP" button (when available)
- 🧭 Automatically crawl and download every individual file if ZIP is not provided
- 🔐 Supports authenticated downloads via user session cookies
./grab_files.sh <eclass_course_url> <mode> <cookies_file>
First Argument (eclass_course_url) is mandatory Second argument (destination_dir) is optional and defaults to the current directory (where the script is run from) Third argument (mode) is optional and defaults to 0 Fourth argument (cookies file) is optional, but if you don't provide one, then you should append your session cookies to a file cookies.txt in the current directory (which is the default file location)
Argument | Description |
---|---|
<eclass_course_url> |
Full URL of the course's main eClass page (e.g. https://eclass.tuc.gr/courses/ABC123/) |
<destination_dir> |
Destination folder for the extracted/downloaded files |
<mode> |
0 = use ZIP button if available; 1 = crawl and download all files individually |
<cookies_file> |
File containing your authenticated session cookies |
You need to export your browser session cookies so the script can authenticate and download the materials.
-
Go to the eClass course page and make sure you're logged in.
-
Open Developer Tools (press Ctrl + Shift + I or Ctrl + F12).
-
Click on the Application tab.
-
In the left sidebar, under Storage → Cookies, select the eClass site (e.g., https://eclass.tuc.gr).
-
Look for the cookie named PHPSESSID in the list.
-
Copy its Name=Value pair (e.g., PHPSESSID=abc123xyz456).
-
Paste this into a plain text file called cookies.txt.
-
Paste it into a file, e.g.
cookies.txt
Your cookie file should look like:
eclass.uniwa.gr TRUE / FALSE 0 PHPSESSID lhr1oqs6nbg09qrerfbm4akqin
Use the extension to export your cookies as plain text and save them to cookies.txt
.
./grab_files.sh "https://eclass.tuc.gr/courses/ABC123/" 0 cookies.txt
This will download the ZIP file (if the button exists) and extract it.
./grab_files.sh "https://eclass.tuc.gr/courses/ABC123/" 1 my_cookies.txt
This will crawl through the course page and download each file individually.
- This script assumes basic familiarity with bash, wget or curl.
- Always respect your institution’s policies for automation and access.
MIT – do whatever you want with it, just don’t blame me if eClass changes everything overnight 😅