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
Open
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Next Next commit
add browser_userdata to config, to set puppeteer's userDataDir
Otherwise, two --user-data-dir are sent to Chrome, which has unexpected effects.
Luckz committed Oct 8, 2022
commit 3bb3e218da494d01bee64423c4b190a5c651b494
2 changes: 2 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
@@ -165,6 +165,8 @@ Below is a list of all available options.

`‑‑browser‑args <args>` | `browser_args` Extra arguments to pass to the browser instance. If provided as a command line argument, this should be a comma-separated list of args. Note that `\ ` is used as an escape character so if you want to use a comma in one of the args, it needs to be escaped so this `--some-arg=a,b,c` would be `--some-arg=a\,b\,c` If provided in the JSON config, this should be an array of strings.

`‑‑browser‑userdata <path>` | `browser_args` If set, use a custom folder as your Chrome profile `--user-data-dir`. By default, Puppeteer will create a fresh folder with a randomized name on each start.

`‑‑watch‑unlisted‑games` | `watch_unlisted_games` When `true`, the app will watch streams of games that are not listed in the config if the listed games' campaigns are completed or no streams are active.

- Default: `false`
8 changes: 6 additions & 2 deletions src/index.tsx
Original file line number Diff line number Diff line change
@@ -294,6 +294,7 @@ const options = [
new IntegerOption("--failed-stream-retry", {defaultValue: 3}),
new IntegerOption("--failed-stream-timeout", {defaultValue: 30}),
new StringListOption("--browser-args"),
new StringOption("--browser-userdata"),
/* new BooleanOption('--update-games', null, false), TODO: auto update games.csv ? */
new BooleanOption("--watch-unlisted-games"),
new BooleanOption("--hide-video"),
@@ -356,6 +357,7 @@ export interface Config {
failed_stream_retry: number,
failed_stream_timeout: number,
browser_args: string[],
browser_userdata: string,
watch_unlisted_games: boolean,
hide_video: boolean,
cookies_path: string,
@@ -532,7 +534,8 @@ async function main(): Promise<void> {
const browser = await puppeteer.launch({
headless: config["headless"],
executablePath: config["browser"],
args: config["browser_args"]
args: config["browser_args"],
...(config["browser_userdata"] && { userDataDir: config["browser_userdata"]})
});

// Automatically stop this program if the browser is closed
@@ -630,7 +633,8 @@ async function main(): Promise<void> {
loginBrowser = await puppeteer.launch({
headless: false,
executablePath: config["browser"],
args: config["browser_args"]
args: config["browser_args"],
...(config["browser_userdata"] && { userDataDir: config["browser_userdata"]})
});
}