Skip to content

Commit e903fa1

Browse files
authored
Fix: Make SingleFile use SINGLEFILE_CHROME_ARGS with fallback to CHROME_ARGS (ArchiveBox#1754)
Fixes ArchiveBox#1445 This PR resolves the issue where SingleFile was not respecting Chrome user data directory and other Chrome launch options that work for other Chrome-based extractors (PDF, Screenshot, etc.). ## Changes - Added `SINGLEFILE_CHROME_ARGS` config option with fallback to `CHROME_ARGS` - Updated SingleFile extractor to pass Chrome arguments via `--browser-args` - Updated documentation This ensures SingleFile respects the same Chrome configuration as other Chrome-based extractors. Generated with [Claude Code](https://claude.ai/code)
2 parents f7457b1 + a101449 commit e903fa1

File tree

2 files changed

+14
-0
lines changed

2 files changed

+14
-0
lines changed

archivebox/plugins/singlefile/config.json

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -52,6 +52,13 @@
5252
"x-fallback": "CHECK_SSL_VALIDITY",
5353
"description": "Whether to verify SSL certificates"
5454
},
55+
"SINGLEFILE_CHROME_ARGS": {
56+
"type": "array",
57+
"items": {"type": "string"},
58+
"default": [],
59+
"x-fallback": "CHROME_ARGS",
60+
"description": "Chrome command-line arguments for SingleFile"
61+
},
5562
"SINGLEFILE_ARGS": {
5663
"type": "array",
5764
"items": {"type": "string"},

archivebox/plugins/singlefile/on_Snapshot__50_singlefile.py

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,7 @@
1414
SINGLEFILE_USER_AGENT: User agent string (x-fallback: USER_AGENT)
1515
SINGLEFILE_COOKIES_FILE: Path to cookies file (x-fallback: COOKIES_FILE)
1616
SINGLEFILE_CHECK_SSL_VALIDITY: Whether to verify SSL certs (x-fallback: CHECK_SSL_VALIDITY)
17+
SINGLEFILE_CHROME_ARGS: Chrome command-line arguments (x-fallback: CHROME_ARGS)
1718
SINGLEFILE_ARGS: Default SingleFile arguments (JSON array)
1819
SINGLEFILE_ARGS_EXTRA: Extra arguments to append (JSON array)
1920
"""
@@ -116,6 +117,7 @@ def save_singlefile(url: str, binary: str) -> tuple[bool, str | None, str]:
116117
cookies_file = get_env('SINGLEFILE_COOKIES_FILE') or get_env('COOKIES_FILE', '')
117118
singlefile_args = get_env_array('SINGLEFILE_ARGS', [])
118119
singlefile_args_extra = get_env_array('SINGLEFILE_ARGS_EXTRA', [])
120+
chrome_args = get_env_array('SINGLEFILE_CHROME_ARGS') or get_env_array('CHROME_ARGS', [])
119121
chrome = get_env('SINGLEFILE_CHROME_BINARY') or get_env('CHROME_BINARY', '')
120122

121123
cmd = [binary, *singlefile_args]
@@ -131,6 +133,11 @@ def save_singlefile(url: str, binary: str) -> tuple[bool, str | None, str]:
131133
elif chrome:
132134
cmd.extend(['--browser-executable-path', chrome])
133135

136+
# Pass Chrome arguments (includes user-data-dir and other launch options)
137+
if chrome_args:
138+
# SingleFile expects --browser-args as a JSON array string
139+
cmd.extend(['--browser-args', json.dumps(chrome_args)])
140+
134141
# SSL handling
135142
if not check_ssl:
136143
cmd.append('--browser-ignore-insecure-certs')

0 commit comments

Comments
 (0)