1
0
mirror of https://github.com/snobu/destreamer.git synced 2026-01-23 16:32:16 +00:00

Fix login for private tenants, improved refresh reliability (#181)

This commit is contained in:
lukaarma
2020-07-19 09:50:23 +02:00
committed by GitHub
parent 0be6ad8b60
commit 78e5818cc3
2 changed files with 7 additions and 8 deletions

View File

@@ -53,8 +53,8 @@ export class TokenCache {
}
export async function refreshSession(): Promise<Session> {
const url = 'https://web.microsoftstream.com';
export async function refreshSession(url: string): Promise<Session> {
const videoId: string = url.split('/').pop() ?? process.exit(ERROR_CODE.INVALID_VIDEO_GUID);
const browser: puppeteer.Browser = await puppeteer.launch({
executablePath: getPuppeteerChromiumPath(),
@@ -70,7 +70,7 @@ export async function refreshSession(): Promise<Session> {
const page: puppeteer.Page = (await browser.pages())[0];
await page.goto(url, { waitUntil: 'load' });
await browser.waitForTarget((target: puppeteer.Target) => target.url().includes(url), { timeout: 30000 });
await browser.waitForTarget((target: puppeteer.Target) => target.url().includes(videoId), { timeout: 30000 });
let session: Session | null = null;
let tries = 1;