Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

add browser_userdata to config, to set puppeteer's userDataDir #219

Open
wants to merge 2 commits into
base: dev
Choose a base branch
from

Conversation

Luckz
Copy link
Contributor

@Luckz Luckz commented Oct 8, 2022

Otherwise, two --user-data-dir are sent to Chrome, which has unexpected effects.

On reflection, adding this to update_games wouldn't be smart, since the updater should be able to run just fine while you're idling streams. You can't have two Chrome sesssions with the same user data directory, and thus you can't have two puppeteers accessing the same Chrome profile.

Luckz added 2 commits October 8, 2022 09:20
Otherwise, two --user-data-dir are sent to Chrome, which has unexpected effects.
@TychoTheTaco
Copy link
Owner

I'm pretty sure just passing --user-data-dir=/whataver/dir to browser_args should work so we don't need a separate option for it. However, I just tried it and it seems Puppeteer is overwriting it anyways. (Actually it adds its own --user-data-dir option in addition to mine but since that one comes first I guess it has priority). The weird thing is I've seen many stack overflow answers saying that it should work.

Anyways if you want to merge this PR, I think it would be better to do the following instead of the current solution: Check if config.browser_args contains a --user-data-dir option. If it does, then remove it (maybe?) from browser_args and pass it directly to puppeteer.launch(). That way we don't need to add another option to the config.

@Luckz
Copy link
Contributor Author

Luckz commented Oct 9, 2022

It's your design decision if you prefer exposing more of Puppeteer's API via config or not. I didn't add it to the config example in the README because indeed people generally don't need to see it.

Educationally it's worse your way, as users will be left thinking that adding --user-data-dir to Puppeteer Chrome args works as all those Stack Overflow users seem to accept.

While on the topic of API exposure, could also imagine someone wanting to play with https://pptr.dev/api/puppeteer.launchoptions.ignoredefaultargs (but that's vastly less useful than the already not that must-have user-data-dir setting)

My hope with this feature was to be able to install a extension from Chrome Web Store and get Puppeteer to not wipe it on startup, but my puppet-fu is low. (Any idea?)
I'm not sure if it's a useful PR at this point (also depends on the resolution of #212 / integrity woes).

@TychoTheTaco
Copy link
Owner

I did some more digging and it turns out that adding --user-data-dir to args does work, however the stealth plugin has a dependency on the user-data-dir plugin, which doesn't check for this arg and just sets a temp dir directly via Puppeteer's API. Seems like an oversight in that plugin.

Given that, I would still prefer my suggestion to not expose any Puppeteer API if we don't have to. I've also been experimenting with manually launching the browser process and then attaching to it with Puppeteer, and in that case it makes more sense to have --user-data-dir as part of the browser_args

I haven't tried using extensions with Puppeteer so not sure how that works. I think it's still a useful PR since its looking like having a consistent user data dir can help avoid detection so we need to allow users to set the location.

@AndyShade
Copy link

How now browser arg must looks like (sr my Eng no so good like i thunk) ? for exaple load extension with id
kfhgpagdjjoieckminnmigmpeclkdmjm + with --disable-accelerated-compositing arg.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants