Fix: Make SingleFile use SINGLEFILE_CHROME_ARGS with fallback to CHROME_ARGS (#1754)

Fixes #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)
This commit is contained in:
Nick Sweeting
2026-01-01 14:34:05 -08:00
committed by GitHub
2 changed files with 14 additions and 0 deletions

View File

@@ -52,6 +52,13 @@
"x-fallback": "CHECK_SSL_VALIDITY",
"description": "Whether to verify SSL certificates"
},
"SINGLEFILE_CHROME_ARGS": {
"type": "array",
"items": {"type": "string"},
"default": [],
"x-fallback": "CHROME_ARGS",
"description": "Chrome command-line arguments for SingleFile"
},
"SINGLEFILE_ARGS": {
"type": "array",
"items": {"type": "string"},

View File

@@ -14,6 +14,7 @@ Environment variables:
SINGLEFILE_USER_AGENT: User agent string (x-fallback: USER_AGENT)
SINGLEFILE_COOKIES_FILE: Path to cookies file (x-fallback: COOKIES_FILE)
SINGLEFILE_CHECK_SSL_VALIDITY: Whether to verify SSL certs (x-fallback: CHECK_SSL_VALIDITY)
SINGLEFILE_CHROME_ARGS: Chrome command-line arguments (x-fallback: CHROME_ARGS)
SINGLEFILE_ARGS: Default SingleFile arguments (JSON array)
SINGLEFILE_ARGS_EXTRA: Extra arguments to append (JSON array)
"""
@@ -116,6 +117,7 @@ def save_singlefile(url: str, binary: str) -> tuple[bool, str | None, str]:
cookies_file = get_env('SINGLEFILE_COOKIES_FILE') or get_env('COOKIES_FILE', '')
singlefile_args = get_env_array('SINGLEFILE_ARGS', [])
singlefile_args_extra = get_env_array('SINGLEFILE_ARGS_EXTRA', [])
chrome_args = get_env_array('SINGLEFILE_CHROME_ARGS') or get_env_array('CHROME_ARGS', [])
chrome = get_env('SINGLEFILE_CHROME_BINARY') or get_env('CHROME_BINARY', '')
cmd = [binary, *singlefile_args]
@@ -131,6 +133,11 @@ def save_singlefile(url: str, binary: str) -> tuple[bool, str | None, str]:
elif chrome:
cmd.extend(['--browser-executable-path', chrome])
# Pass Chrome arguments (includes user-data-dir and other launch options)
if chrome_args:
# SingleFile expects --browser-args as a JSON array string
cmd.extend(['--browser-args', json.dumps(chrome_args)])
# SSL handling
if not check_ssl:
cmd.append('--browser-ignore-insecure-certs')