mirror of
https://github.com/snobu/destreamer.git
synced 2026-02-16 19:49:41 +00:00
Cleanup
This commit is contained in:
@@ -1,6 +1,9 @@
|
|||||||
|
//@ts-check
|
||||||
const execSync = require('child_process').execSync;
|
const execSync = require('child_process').execSync;
|
||||||
const puppeteer = require('puppeteer');
|
const puppeteer = require('puppeteer');
|
||||||
const term = require('terminal-kit').terminal;
|
const term = require('terminal-kit').terminal;
|
||||||
|
const fs = require('fs');
|
||||||
|
const path = require('path');
|
||||||
|
|
||||||
// Type in your username here (the one you use to
|
// Type in your username here (the one you use to
|
||||||
// login to Microsoft Stream).
|
// login to Microsoft Stream).
|
||||||
@@ -19,6 +22,12 @@ function sanityChecks() {
|
|||||||
process.exit(22);
|
process.exit(22);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (!fs.existsSync(outputDirectory)){
|
||||||
|
console.log('Creating output directory: ' +
|
||||||
|
process.cwd() + path.sep + outputDirectory);
|
||||||
|
fs.mkdirSync(outputDirectory);
|
||||||
|
}
|
||||||
|
|
||||||
if (args[0] == null || args[0].length < 10) {
|
if (args[0] == null || args[0].length < 10) {
|
||||||
console.error('Pass in video URL as first argument: \n' +
|
console.error('Pass in video URL as first argument: \n' +
|
||||||
'Example: npm start https://www.microsoftstream.com/video/6f1a382b-e20c-44c0-98fc-5608286e48bc\n');
|
'Example: npm start https://www.microsoftstream.com/video/6f1a382b-e20c-44c0-98fc-5608286e48bc\n');
|
||||||
@@ -29,7 +38,8 @@ function sanityChecks() {
|
|||||||
async function rentVideoForLater() {
|
async function rentVideoForLater() {
|
||||||
console.log('Launching headless Chrome to perform the OpenID Connect dance...');
|
console.log('Launching headless Chrome to perform the OpenID Connect dance...');
|
||||||
const browser = await puppeteer.launch({
|
const browser = await puppeteer.launch({
|
||||||
headless: false, // Switch to false if you have to login interactively
|
// Switch to false if you need to login interactively
|
||||||
|
headless: false,
|
||||||
args: ['--disable-dev-shm-usage']
|
args: ['--disable-dev-shm-usage']
|
||||||
});
|
});
|
||||||
const page = await browser.newPage();
|
const page = await browser.newPage();
|
||||||
@@ -71,7 +81,7 @@ async function rentVideoForLater() {
|
|||||||
await browser.close();
|
await browser.close();
|
||||||
|
|
||||||
console.log('Constructing HLSv3 URL...');
|
console.log('Constructing HLSv3 URL...');
|
||||||
hlsUrl = amsUrl.substring(0, amsUrl.lastIndexOf('/')) + '/manifest(format=m3u8-aapl-v3)';
|
const hlsUrl = amsUrl.substring(0, amsUrl.lastIndexOf('/')) + '/manifest(format=m3u8-aapl-v3)';
|
||||||
|
|
||||||
|
|
||||||
console.log('Spawning youtube-dl with cookie and HLSv3 URL...');
|
console.log('Spawning youtube-dl with cookie and HLSv3 URL...');
|
||||||
@@ -107,5 +117,3 @@ async function exfiltrateCookie(page) {
|
|||||||
|
|
||||||
sanityChecks();
|
sanityChecks();
|
||||||
rentVideoForLater();
|
rentVideoForLater();
|
||||||
|
|
||||||
console.log('\nEverything is okay when everything is okay. Exiting...');
|
|
||||||
Reference in New Issue
Block a user