/artemis-dl

Download exercises from https://artemis.in.tum.de/

Primary LanguagePython

Recent Changes: Current Windows binary now chooses MS Edge as the default browser and also works with later or previous browser versions. Bugs were also fixed and code was adjusted to new artemis version. Enjoy!

Introduction

Hello and welcome to my GitHub repository! As a student at TUM utilizing the Tum Artemis platform, I felt the need to create a way to permanently archive all of our exercises. I believe in the value of preserving knowledge, so I designed this tool to ensure I, and others, can download and access these exercises indefinitely - even 30 years down the road. This tool creates a completely local copy of exercises and doesn't depend on any third party services or servers to ensure the longevity.

Features:

  • Dark-Mode PDFs: Download exercises as pdf while preserving the dark theme.
  • Exercise Repositories: Find and download repositories (even hidden ones) of exercises directly from the Artemis git server (bitbucket).
  • One-command Course Download: And all of this with only one command!!. Download full Artemis-Courses with a single command, creating a lasting local archive.

Each exercise gets the following folder structure after download (was added in the newest release 0.2.0):

Exercise-Name/
├── repos/
│   ├── repo/
│   ├── repo-practice/
│   └── repo-solution/
├── webpage/
│   ├── assets/
│   └── index.html
└── exercise.pdf

Further down, you'll encounter step-by-step installation instructions and additional details to assist in your setup. Here's to preserving our academic endeavors for the future!

Install & Use

Currently, there are three supported methods to utilize this scraper. Choose the one that best fits your needs. For those less tech-savvy, the first option is recommended and is tailored specifically for Windows users.

1. Use preconfigured binary (Windows)(recommended)

Prerequisites

  • Microsoft Edge (should be preinstalled on your PC)
  • Git (should be in PATH)

Installation

  1. Download binary
  2. Open "Windows Terminal" or "cmd.exe" and navigate to the folder, in which the binary exists.
cd C:\path\to\folder
  1. Now run
artemis-dl_x86.exe dl-course --username YOUR_USERNAME --password YOUR_PASSWORD --link COURSE_LINK # Showcase
artemis-dl_x86.exe dl-course --username ab12cde --password 12345678 --link "https://artemis.in.tum.de/courses/201/exercises" # Real Example
### you can also specify download location with adding '--download-path YOUR_DOWNLOAD_PATH' to the end of the command. Otherwise a folder named 'downloads' will be created in the location of the binary file. 
  1. If you got to here and liked the downloader, don't forget to give the repo a star ⭐. Enjoy 🥳😝
2. Run from source code (Windows)

Prerequisites

  • Microsoft Edge (should be preinstalled on your PC)
  • Git (should be in PATH)
  • python
  • venv (should be installed together with python)

Installation

  1. Clone Repository to your local computer with
git clone https://github.com/hruzgar/artemis-dl.git
  1. Now open terminal and navigate to the project-folder
cd C:\path\to\project_folder
  1. Create a new venv envoirenment inside project folder
python -m venv .
  1. Activate the created envoirement
.\Scripts\activate
  1. Install all dependencies from requirements.txt file with
pip install -r requirements.txt
  1. Finally run Scraper!
python main.py dl-course --username YOUR_USERNAME --password YOUR_PASSWORD --link COURSE_LINK # Showcase
python main.py dl-course --username ab12cde --password 12345678 --link "https://artemis.in.tum.de/courses/201/exercises" # Real Example
3. Run from source code (Linux)

This guide was for the older artemis-dl versions. You might be better off, using the Windows binary if you're able to. The current codebase needs some changes to choose chrome instead of MS Edge if on Linux and also someone needs to test if it works. Currently i don't have the time to do it but please make a pull request if you do..

Prerequisits

  • Google-Chrome
  • Git
  • python3
  • venv for python

Installation

  1. Clone Repo
git clone https://github.com/hruzgar/artemis-dl.git
  1. cd into project
cd artemis-dl
  1. Create venv envoirenment and activate afterwards
python3 -m venv .
source bin/activate
  1. Install python modules
pip install -r requirements.txt
  1. Run Scraper
python3 main.py dl-course --username YOUR_USERNAME --password YOUR_PASSWORD --link COURSE_LINK # Showcase
python3 main.py dl-course --username ab12cde --password 12345678 --link "https://artemis.in.tum.de/courses/201/exercises" # Real Example

Other stuff

FAQ
Which courses are supported?

Currently only 2 courses are officially supported. These are:

Other courses might also work but weren't tested. If this scraper works for your course please send an email to haso@ruezgar.de so i can add it to the list. If your course does not work with this scraper you could also send an email for me to support the course (i would need your login details) or just contribute to the project.


What is a course-link and how can i find it?

You can get the course-link of your course, if you open your Artemis Course-Page from any browser and copy the link.


If you have any other questions, you can reach out to me on haso@ruezgar.de

Roadmap
  • Download Quizzes
    • Currently quizzes are directly skipped if found.
Behind the scenes

In the recent releases its not the same steps anymore. Will update this later

  1. Logs in into Artemis
  2. Crawls all exercises for specified course
  3. Repeatedly does Step 4-8
  4. Downloads html of exercise-page
  5. injects custom-css into html-page
  6. prints html to pdf
  7. finds all repositories on exercise-page and clones them (hidden repositories like test-repos etc are included)
  8. Puts all files into a nicely named folder 🥰
  9. Lets you enjoy all your exercises in the future 🤩
Building the Windows Binary
  • using 'auto-py-to-exe'
  • select your artemis build folder (same as repo but without ".git" folder)
  • select 'One File'
  • In 'Advanced > --paths' add the'site-packages' directory of your envoirenment. This will contain all the modules. For example "D:/code/artemis-dl/lib/python3.10/site-packages" for venv or "C:\Users\haso\miniconda3\envs\scrape\Lib\site-packages" for conda
  • In 'Additional Files' click 'Add Folder' and open root path of project. In the right input box just put a dot '.'

Disclaimer: This application is provided for educational and personal use only. Users must ensure compliance with the policies of their respective educational institution and applicable laws. This software is independently developed, not affiliated with, endorsed by, or supported by any university or institution. Users assume all responsibility and risk associated with the use of this tool.