SamuelScheit / puppeteer-stream

A Library for puppeteer to retrieve audio and/or video streams
MIT License
333 stars 105 forks source link

Have waitForTarget() extension search use url instead of private field. #73

Closed dax-hurley closed 1 year ago

dax-hurley commented 1 year ago

In WSL Ubuntu 20.04 using this package combined with puppeteer v19.2.2 and puppeteer-extra v3.3.4 for it's stealth plugin (following the example in the readme) I got the following error:

TypeError: Cannot read properties of undefined (reading 'title')
    at <FILE PATH>/puppeteer-stream/src/PuppeteerStream.ts:99:73
...

I eventually traced the error back to the _targetInfo field of the Target object being undefined. It appears that the Pupeteer contributors renamed this to #targetInfo which is using the strongly enforced private class field ES6 proposal in a commit on June 13th. Since this is a private field the library shouldn't have been relying on it for functionality. As an alternative I added a check to see if the target's URL matches the correct extension url based off extension id.

Thank you to all the contributors for for your work on this library it's very useful. 😄

dax-hurley commented 1 year ago

@Flam3rboy Thanks for merging my PR! Would you mind updating the npm package?

SamuelScheit commented 1 year ago

@dax-hurley published 👍

npm i puppeteer-stream@2.1.2