Download video from Microsoft Stream
Have a look at this project on github. Its called destreamer and basically does what you want. Depends on your University, you can find a version customized with the specific automated login for your school and for sure one is for the Milano Politecnico which is an italian university that goes under the name PoliDown.
Destreamer works by grapping the m3u streaming and combine it back using FFMPEG.