No description
Find a file
2019-09-19 17:55:52 +03:00
.vscode Public release 2019-03-12 12:37:03 +02:00
.gitignore Public release 2019-03-12 12:37:03 +02:00
destreamer.js Cleanup 2019-03-12 12:51:15 +02:00
LICENSE Added MIT license 2019-09-05 09:30:32 +03:00
logo.png Added logo 2019-03-12 13:47:54 +02:00
package-lock.json Public release 2019-03-12 12:37:03 +02:00
package.json Public release 2019-03-12 12:37:03 +02:00
README.md Added ffmpeg to prereqs 2019-09-19 17:55:52 +03:00

Destreamer

Saves Microsoft Stream videos for offline enjoyment.

Alpha-quality, don't expect much. It does work though, so that's a neat feature.

It's slow (e.g. a 60-min video takes 20-30 minutes to download). Not much i can do about it for now unless i find a better way than ripping HLS.

DISCLAIMER

Hopefully this doesn't break the end user agreement for Microsoft Stream. Since we're simply saving the HLS stream to disk as if we were a browser, this does not abuse the streaming endpoints. However i take no responsibility if either Microsoft or your Office 365 admins request a chat with you in a small white room.

PREREQS

  • Node.js: anything above v8.0 will probably work. Tested on v11.6.0.
  • youtube-dl: https://ytdl-org.github.io/youtube-dl/download.html, you'll need a fairly recent version that understands encrypted HLS streams. This needs to be in your $PATH. Destreamer calls youtube-dl with a bunch of arguments.
  • Destreamer takes a honeybadger approach towards the OS it's running on, tested on Windows, results may vary, feel free to open an Issue if trouble arise.
  • ffmpeg: a recent version (year 2019 or above), in $PATH.

USAGE

  • Edit destreamer.js and replace the username const with your own, you may still need to enter your password or go through 2FA if you don't have the STS cookie saved in Chrome. If you do (i.e. you usually log in to Microsoft Stream with Chrome), then you may try turning headless: false to true for a truly headless experience)
  • npm i to restore packages
  • npm start <URL of the video>

EXPECTED OUTPUT

Using youtube-dl version 2019.01.17
Launching headless Chrome to perform the OpenID Connect dance...

Navigating to STS login page...
We are logged in. Sorry, i mean "you".
Got cookie. Consuming cookie...
Looking up AMS stream locator...
Video title is: Mondays with IGD 11th March-2019
At this point Chrome's job is done, shutting it down...
Constructing HLSv3 URL...
Spawning youtube-dl with cookie and HLSv3 URL...

[generic] manifest(format=m3u8-aapl-v3): Requesting header
[generic] manifest(format=m3u8-aapl-v3): Downloading m3u8 information
[download] Destination: Mondays with IGD 11th March-2019.mp4
ffmpeg version 4.0.2 Copyright (c) 2000-2018 the FFmpeg developers
  built with gcc 7.3.1 (GCC) 20180722
  configuration: --enable-gpl --enable-version3 --enable-sdl2 --enable-bzlib 

[...]

frame= 8435 fps= 67 q=-1.0 Lsize=  192018kB time=00:05:37.38 bitrate=4662.3kbits/s speed=2.68x
video:186494kB audio:5380kB subtitle:0kB other streams:0kB global headers:0kB muxing overhead: 0.074759%
[ffmpeg] Downloaded 196626728 bytes
[download] Download completed

The video is now saved under videos/, or whatever the outputDirectory const points to.