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

disable additional Chrome UI / bubbles #133

Merged
merged 1 commit into from
Sep 18, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
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
8 changes: 7 additions & 1 deletion built/brave/puppeteer.js
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,10 @@ const disabledBraveFeatures = [
'TextClassification',
'SiteVisit',
];
const disabledChromeFeatures = [
'IPH_SidePanelGenericMenuFeature',
];
const disabledFeatures = disabledBraveFeatures.concat(disabledChromeFeatures);
const profilePathForArgs = (args) => {
const logger = getLogger(args);
// The easiest case is if we've been told to use an existing profile.
Expand Down Expand Up @@ -51,12 +55,14 @@ export const puppeteerConfigForArgs = (args) => {
const { profilePath, shouldClean } = profilePathForArgs(args);
process.env.PAGEGRAPH_OUT_DIR = args.outputPath;
const chromeArgs = [
'--ash-no-nudges',
'--deny-permission-prompts',
'--disable-brave-update',
'--disable-breakpad',
'--disable-component-extensions-with-background-pages',
'--disable-component-update',
'--disable-features=' + disabledBraveFeatures.join(','),
'--disable-features=' + disabledFeatures.join(','),
'--disable-first-run-ui',
'--disable-infobars',
'--disable-ipc-flooding-protection',
'--disable-notifications',
Expand Down
7 changes: 7 additions & 0 deletions changelog.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,10 @@
Version 1.1.0
---

Also pass `--disable-first-run-ui`, to suppress some additional, unneeded and
unwanted browser UI, and disable the Chrome `IPH_SidePanelGenericMenuFeature`
for the same reason.

Version 1.0.2
---

Expand Down
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "pagegraph-crawl",
"version": "1.0.4",
"version": "1.1.0",
"description": "CLI for crawling with PageGraph.",
"scripts": {
"lint": "npx eslint src/**/*.ts src/*.ts",
Expand Down
10 changes: 9 additions & 1 deletion src/brave/puppeteer.ts
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,12 @@ const disabledBraveFeatures = [
'SiteVisit',
]

const disabledChromeFeatures = [
'IPH_SidePanelGenericMenuFeature',
]

const disabledFeatures = disabledBraveFeatures.concat(disabledChromeFeatures)

interface ProfilePath {
profilePath: FilePath
shouldClean: boolean
Expand Down Expand Up @@ -74,12 +80,14 @@ export const puppeteerConfigForArgs = (args: CrawlArgs): PuppeteerConfig => {
process.env.PAGEGRAPH_OUT_DIR = args.outputPath

const chromeArgs = [
'--ash-no-nudges',
'--deny-permission-prompts',
'--disable-brave-update',
'--disable-breakpad',
'--disable-component-extensions-with-background-pages',
'--disable-component-update',
'--disable-features=' + disabledBraveFeatures.join(','),
'--disable-features=' + disabledFeatures.join(','),
'--disable-first-run-ui',
'--disable-infobars',
'--disable-ipc-flooding-protection',
'--disable-notifications',
Expand Down
20 changes: 10 additions & 10 deletions src/run.ts
Original file line number Diff line number Diff line change
Expand Up @@ -19,17 +19,17 @@ parser.add_argument('-v', '--version', {
})
parser.add_argument('-b', '--binary', {
help: 'Path to the PageGraph enabled build of Brave. If not provided, '
+ 'try to guess where the binary is, or if its in $PATH',
+ 'try to guess where the binary is, or if its in $PATH',
})
parser.add_argument('-r', '--recursive-depth', {
default: 1,
help: 'If provided, choose a link at random on page and do another crawl '
+ 'to this depth. Default: 1 (no recursion).',
+ 'to this depth. Default: 1 (no recursion).',
})
parser.add_argument('-o', '--output', {
help: 'Path to write to. If a directory is provided, then results are '
+ 'written to a file in that directory. If a full path is given, '
+ 'then results are written to that path.',
+ 'written to a file in that directory. If a full path is given, '
+ 'then results are written to that path.',
required: true,
})
parser.add_argument('-u', '--url', {
Expand All @@ -38,11 +38,11 @@ parser.add_argument('-u', '--url', {
})
parser.add_argument('-e', '--existing-profile', {
help: 'The chromium profile to use when crawling. Cannot '
+ 'be used with "--persist-profile"',
+ 'be used with "--persist-profile"',
})
parser.add_argument('-p', '--persist-profile', {
help: 'If provided, the user profile will be saved at this path. Cannot '
+ 'be used with "--existing-profile"',
+ 'be used with "--existing-profile"',
default: false,
action: 'store_true',
})
Expand All @@ -52,7 +52,7 @@ parser.add_argument('--extensions-path', {
})
parser.add_argument('-s', '--shields', {
help: 'Whether to measure with shields up or down. Ignored when using '
+ `"--existing-profile". Default: ${defaultShieldsSetting}`,
+ `"--existing-profile". Default: ${defaultShieldsSetting}`,
choices: ['up', 'down'],
default: defaultShieldsSetting,
})
Expand All @@ -68,7 +68,7 @@ parser.add_argument('--logging', {
})
parser.add_argument('-i', '--interactive', {
help: 'Suppress use of Xvfb to allow interaction with spawned '
+ 'browser instance',
+ 'browser instance',
action: 'store_true',
default: false,
})
Expand All @@ -82,12 +82,12 @@ parser.add_argument('--proxy-server', {
})
parser.add_argument('-x', '--extra-args', {
help: 'Pass JSON_ARRAY as extra CLI argument to the browser '
+ 'instance launched.',
+ 'instance launched.',
metavar: 'JSON_ARRAY',
})
parser.add_argument('-c', '--crawl-duplicates', {
help: 'Enable crawls for redirected URLs that are already present in '
+ 'the redirection chain.',
+ 'the redirection chain.',
action: 'store_true',
default: false,
})
Expand Down