Last active
March 9, 2023 09:34
-
-
Save henrydatei/b85f2ffbe0390b2e8b069ab1e5765986 to your computer and use it in GitHub Desktop.
Download a video from Videocampus Sachsen
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#file=$1 | |
#videoname=$(echo "$file" | cut -d "." -f1) | |
#echo "$videoname" | |
touch playlist.txt | |
touch urllist.txt | |
key=$1 | |
videoname=$2 | |
#keystring=$(cat $file | grep -o -E "key=[0-9,a-z]+") | |
#key=$(echo "$keystring" | cut -c 5-) | |
link="https://videocampus.sachsen.de/media/hlsMedium/key/$key/format/auto/ext/mp4/learning/0/path/m3u8" | |
playlist=$(curl -s "$link" | tail -n 1) | |
newLink="https://videocampus.sachsen.de/media/hlsMedium/key/$key/format/auto/ext/mp4/learning/0/path/$playlist" | |
wget -O playlist.m3u8 "$newLink" | |
for line in $(cat playlist.m3u8 | grep ".ts"); do | |
partLink="https://videocampus.sachsen.de/media/hlsMedium/key/$key/format/auto/ext/mp4/learning/0/path/$line" | |
echo "$partLink" >> urllist.txt | |
echo "file $line" >> playlist.txt | |
done | |
cat urllist.txt | parallel -j 50 'wget {}' | |
ffmpeg -f concat -i playlist.txt -c copy $videoname.mp4 | |
rm playlist.m3u8 | |
rm playlist.txt | |
rm urllist.txt | |
rm *.ts |
To download some videos today I wasn't succesful with the script but these steps worked:
- In Browser login to Videocampus
- Press Play on the video
- Open Developer Tools > Tab Network
- Use the XHR filter
- Right-Click on any of the files of type ocet-stream, copy as link (German "Wer kopieren" > "Als Link kopieren")
- Replace the string as follows:
# in
https://videocampus.sachsen.de/media/hlsMedium/key/[String A]/format/auto/ext/mp4/learning/0/path/[String A]_[String B]_480p_mp4_193.ts
# out
https://videocampus.sachsen.de/getMedium/[String A].mp4?[String B]&format=1080p
Example:
# in
https://videocampus.sachsen.de/media/hlsMedium/key/f5eo8eezg6n19eo53v74a3965ll5rs02r/format/auto/ext/mp4/learning/0/path/f5eo8eezg6n19eo53v74a3965ll5rs02r_1666077443_480p_mp4_193.ts
# out
https://videocampus.sachsen.de/getMedium/f5eo8eezg6n19eo53v74a3965ll5rs02r.mp4?1666077443&format=1080p
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
I just retried it without deleting anything and it worked for all videos.
The only thing I changed, is that I worked from a different network. No clue, what the problem was :)