snobu / destreamer

Save Microsoft Stream videos for offline enjoyment.
MIT License
2.36k stars 442 forks source link

Failed to load browser process #366

Open Lucetia opened 3 years ago

Lucetia commented 3 years ago

Since I couldn't get it to load chromium with puppeteer I had to go through and put in the manual path in the destreamer.ts file.

When I run destreamer I have it process a file that contains a bunch of links. Once it gets to Video 19 / 20 it will start to fail.

So basically Videos 1-18 or 1-19 (first time it stopped after 18, second time was 19). Then when it goes to download the next video and refresh the access token it comes up with a error. It looks like when the refresh goes to process it falls back to the puppeteer version of chromium (which I had issues with in the past and had to put in the manual path).

I'm not sure if this is enough information to help figure out what might be causing it, but this is what occurs on my screen:

Downloading video no.20 

Downloading video segments 

progress [███████████████████████████████████████████████████████████████████████████████] 100%   2.34 MB/s   0s

Downloading audio segments 

progress [███████████████████████████████████████████████████████████████████████████████] 100%   1.37 MB/s   0s

Merging and decrypting video and audio segments...

Decrypted!

Merging vdeo and audio together...

Done! Removing temp files...

Video no.20 downloaded!!

Downloading video no.21 

Trying to refresh access token...

[ERROR] Error: Failed to launch the browser process!
/home/pi/destreamerv3/node_modules/puppeteer/.local-chromium/linux-818858/chrome-linux/chrome: 1: /home/pi/destreamerv3/node_modules/puppeteer/.local-chromium/linux-818858/chrome-linux/chrome: Syntax error: "(" unexpected

TROUBLESHOOTING: https://github.com/puppeteer/puppeteer/blob/main/docs/troubleshooting.md

    at onClose (/home/pi/destreamerv3/node_modules/puppeteer/lib/cjs/puppeteer/node/BrowserRunner.js:193:20)
    at Interface.helper_js_1.helper.addEventListener (/home/pi/destreamerv3/node_modules/puppeteer/lib/cjs/puppeteer/node/BrowserRunner.js:183:68)
    at Interface.emit (events.js:203:15)
    at Interface.close (readline.js:397:8)
    at Socket.onend (readline.js:173:10)
    at Socket.emit (events.js:203:15)
    at endReadableNT (_stream_readable.js:1145:12)
    at process._tickCallback (internal/process/next_tick.js:63:19)

[FATAL ERROR] Unhandled error or uncaught exception! 
Please check your download directory/directories and try again. 
If this keep happening please report it on github "https://github.com/snobu/destreamer/issues" 
Straitjacket99 commented 3 years ago

me too x

snobu commented 3 years ago

You'll need to amend the browser path executablePath in this method as well - https://github.com/snobu/destreamer/blob/1da56990bc23a743452752cd6b6fc20b458b45b5/src/TokenCache.ts#L57

We should fix this and make it common for anything that calls puppeteer but that requires time commitment so can't promise anything.

CxrlosKenobi commented 3 years ago

I just solved the error on my Raspberry Pi 3b+, editing the src/TokenCache.ts and src/destreamer.ts files. Just add the the next line at the end of const browser: ...

ignoreDefaultArgs: ['--disable-extensions']

Now my code looks like this and worked succesfully:

const browser: puppeteer.Browser = await puppeteer.launch({
  executablePath: '/usr/bin/chromium-browser',
  ...,
  ignoreDefaultArgs: ['--disable-extensions']
});

Hope this can help you guys.