1
0
mirror of https://github.com/snobu/destreamer.git synced 2026-04-17 15:51:46 +00:00

Merge branch 'dev' into patch-1

This commit is contained in:
Adrian Calinescu
2020-03-22 14:17:08 +02:00
committed by GitHub
2 changed files with 103 additions and 103 deletions

View File

@@ -31,10 +31,6 @@ Destreamer takes a [honeybadger](https://www.youtube.com/watch?v=4r7wHMg5Yjg) ap
## USAGE ## USAGE
* Edit `destreamer.ts` 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) * Edit `destreamer.ts` 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)
* To choose preferred video format and quality you can use the "--format" option, it doesn't add anyting new, it only expose a native youtube-dl option, you can find details about accepted parameters on official youtube-dl README here ===> [FORMAT SELECTION](https://github.com/ytdl-org/youtube-dl/blob/master/README.md#format-selection)
If you do not pass any option it will download the best available quality by default.
=======
* Edit `destreamer.ts` (`.js` if using the vanilla JS master branch) 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 install` to restore packages* `npm install` to restore packages * `npm install` to restore packages* `npm install` to restore packages
* `npm run -s build` to transpile TypeScript to JavaScript * `npm run -s build` to transpile TypeScript to JavaScript
@@ -59,10 +55,8 @@ $ node destreamer.js --username username@example.com --outputDirectory "videos"
``` ```
You can use an absolute path for `--outputDirectory`, for example `/mnt/videos`. You can use an absolute path for `--outputDirectory`, for example `/mnt/videos`.
### To download a list of videos To choose preferred video format and quality you can use the `-f` (`--format`) option. It exposes a native [`youtube-dl` parameter][4].
If you do not pass this parameter then `youtube-dl` will download the best available quality for each video.
~~There's no implementation that does that (yet). There's some work happening to support this, give it some time.~~
See usage above.
## EXPECTED OUTPUT ## EXPECTED OUTPUT
@@ -100,3 +94,6 @@ The video is now saved under `videos/`, or whatever the `outputDirectory` const
## _IT JUST KEEPS CRASHING FOR ME!_ ## _IT JUST KEEPS CRASHING FOR ME!_
Check out this issue if it keeps crashing for you - Check out this issue if it keeps crashing for you -
https://github.com/snobu/destreamer/issues/6 https://github.com/snobu/destreamer/issues/6
[4]: https://github.com/ytdl-org/youtube-dl/blob/master/README.md#format-selection

View File

@@ -96,12 +96,15 @@ async function rentVideoForLater(videoUrls: string[], username: string, outputDi
() => { return amp.Player.players["vjs_video_3"].cache_.src } () => { return amp.Player.players["vjs_video_3"].cache_.src }
); );
const title = await page.evaluate( let title = await page.evaluate(
// Clear abuse of null assertion operator, // Clear abuse of null assertion operator,
// someone fix this please // someone fix this please
() => { return document!.querySelector(".title")!.textContent!.trim() } () => { return document!.querySelector(".title")!.textContent!.trim() }
); );
// Sanitize title
title = title.replace(/"/g, '');
console.log(`Video title is: ${title}`); console.log(`Video title is: ${title}`);
console.log('Constructing HLS URL...'); console.log('Constructing HLS URL...');