ScriptSmith / instamancer

Scrape Instagram's API with Puppeteer
http://adamsm.com/instamancer
MIT License
399 stars 61 forks source link

Instamancer: Electron and Asar Packaging #30

Closed bwyyoung closed 4 years ago

bwyyoung commented 4 years ago

I created a modification allowing for Instamancer to be used with Electron and ASAR packaging. This is with the following options when built with electron-packager:

--asar.unpack='**/node_modules/puppeteer/.local-chromium/**/*'

Therefore, Puppeteer can run with electron as a secondary chromium instance, and still perform scraping. Thank you.

ScriptSmith commented 4 years ago

The Instagram class already contains an executablePath option which this PR isn't compatible with.

I'm not really familiar with electron / asar, but why can't you use that option or PUPPETEER_EXECUTABLE_PATH when using instamancer in your application?

bwyyoung commented 4 years ago

Can you show me an example of changing the executable path for puppeteer with instamancer? I could not find how to do it in your readme

bwyyoung commented 4 years ago

The executable path needs to be changed before instamancer launches a puppeteer browser.

ScriptSmith commented 4 years ago

It's the third last option here, and you can see it being used just under the change you made.

bwyyoung commented 4 years ago

Thank you. you are correct. it does work with that parameter:

executablePath: this.puppeteer.executablePath().replace('app.asar', 'app.asar.unpacked')

ScriptSmith commented 4 years ago

If you want to submit a PR adding instructions for using instamancer with with electron to the FAQ, I'd be happy to accept.