├── .gitignore ├── uninstall.sh ├── auth.png ├── example.png ├── install.sh ├── vcs-downloader.py └── README.md /.gitignore: -------------------------------------------------------------------------------- 1 | *.ts -------------------------------------------------------------------------------- /uninstall.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | rm ~/.local/bin/vcs-downloader 3 | -------------------------------------------------------------------------------- /auth.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/spyfly/videocampus-sachsen-downloader/HEAD/auth.png -------------------------------------------------------------------------------- /example.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/spyfly/videocampus-sachsen-downloader/HEAD/example.png -------------------------------------------------------------------------------- /install.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | BIN_PATH=~/.local/bin/vcs-downloader 3 | mkdir ~/.local 4 | mkdir ~/.local/bin 5 | echo $'#!/bin/bash\npython3 '$PWD'/vcs-downloader.py $1 $2' > $BIN_PATH 6 | chmod +x $BIN_PATH 7 | echo "Installed vcs-downloader successfully" 8 | -------------------------------------------------------------------------------- /vcs-downloader.py: -------------------------------------------------------------------------------- 1 | import sys 2 | import urllib.request 3 | import re 4 | import ssl 5 | 6 | if (len(sys.argv) > 1 and sys.argv[1]): 7 | downloadUrl = sys.argv[1] 8 | else: 9 | downloadUrl = input("Please enter the Download URL: ") 10 | downloadUrl = re.sub("_[0-9]{3}.ts", "", downloadUrl) 11 | 12 | if (len(sys.argv) > 2 and sys.argv[2]): 13 | filename = sys.argv[2] + ".ts" 14 | else: 15 | filename = input("File Name? (No ext and special chars): ") + ".ts" 16 | print("Downloading from " + downloadUrl) 17 | 18 | filesize = 100 19 | i = 0 20 | videodata = "" 21 | context = ssl._create_unverified_context() 22 | phpSessId = None 23 | while filesize > 0: 24 | numberStr = str(i) 25 | if i < 10000: 26 | numberStr = numberStr.zfill(3) 27 | url = downloadUrl + "_"+ numberStr +".ts" 28 | localFile = numberStr + ".ts" 29 | #print(url) 30 | print('.', end='',flush=True) 31 | #urllib.request.urlretrieve(url, localFile) 32 | try: 33 | request = urllib.request.Request(url) 34 | # Add login Cookie 35 | if (phpSessId): 36 | request.add_header("Cookie", "PHPSESSID=" + phpSessId) 37 | response = urllib.request.urlopen(request, context=context) 38 | ts = response.read() 39 | filesize = len(ts) 40 | tsfile = open(filename, 'ab') 41 | tsfile.write(ts) 42 | #filesize = os.stat(localFile).st_size 43 | i = i + 1 44 | except urllib.error.HTTPError as e: 45 | if (e.code == 404): 46 | if (i < 10): 47 | phpSessId = input("Please enter the PHPSESSID Cookie: ") 48 | else: 49 | # Pretend filesize is 0 to exit loop 50 | filesize = 0 51 | else: 52 | print('HTTP Error at', url, '| Code:', e.code) 53 | print('Done downloading ' + localFile + '!') -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | # VideoCampus Sachsen Downloader 2 | This is a tool designed for downloading content from the [VideoCampus Sachsen](https://videocampus.sachsen.de/) and learning plattforms that rely on it, such as [Bildungsportal Sachsen - OPAL](https://bildungsportal.sachsen.de/opal). 3 | 4 | With this tool you can download the lecture videos and learn at your oww pace, at your place of choice and without the need for having an internet connection available. 5 | 6 | The downloaded videos will be in the .TS format, therefore it's suggested to use a tool such as [Handbrake](https://handbrake.fr/) to convert them to a more common format such as MP4 with H.264/H.265 encoding, depending on the target devices. 7 | 8 | If you enjoy using this tool, leave a star on GitHub. 9 | 10 | ## Installation 11 | 1. Install Python 3 12 | 2. [Download ZIP](https://github.com/spyfly/videocampus-sachsen-downloader/archive/refs/heads/master.zip) or clone the repository with `git clone https://github.com/spyfly/videocampus-sachsen-downloader.git` 13 | 3. Enter the videocampus-sachsen-downloader directory 14 | 4. Execute `./install.sh` to install the program 15 | 16 | ## Interactive Usage 17 | 1. Open a terminal and write `vcs-downloader` 18 | 2. Enter the video stream URL 19 | 3. Give the file a name and wait for the download to finish 20 | 21 | ## CLI Usage 22 | 1. Write `vcs-downloader [Download-URL] [Target-Filename]` 23 | 24 | ## Retrieving the video stream URL 25 | 1. Open the console of your browser (F12) and select the Network Inspector Tab 26 | 2. Select the XHR request type and start playing the Video 27 | 3. Now right click one of the marked URLs with a .ts file extension and copy the URL as seen on the image below. 28 | 29 | ![Example](./example.png "Network Inspector Example") 30 | 31 | ## Authentication 32 | Sometimes the application may prompt you for authentication. In that case just copy the PHPSESSID from your browser, so that the downloader can authenticate aswell. 33 | ![Authentication](./auth.png "Authentication Example") 34 | --------------------------------------------------------------------------------