F2 Configuration#
F2 uses a layered YAML configuration system to manage app settings. Understanding the file hierarchy, how to initialize configs, and a known compatibility break with --auto-cookie on Chromium v128+ are the three things most engineers need up front.
Configuration File Architecture#
F2 has four config file types :
| File | Purpose |
|---|---|
app.yaml | Low-frequency / main config. Stores infrequently changed settings: cookie, naming, path, timeout, max_retries, etc. |
conf.yaml | F2 framework settings: per-app computation parameters, proxies. |
defaults.yaml | Default template; used as the source when --init-config generates a new file. |
<custom>.yaml | High-frequency / user config. Overrides only the parameters you set. Used per-target-user or per-use-case. |
The ConfigManager class merges these files at runtime . Priority order: CLI args > custom config > app.yaml .
The high/low frequency split means you keep cookies and global defaults in app.yaml and only put frequently changing params (URL, mode) in per-user custom configs.
Config files are installed under <python-site-packages>/f2/conf/. Run pip show f2 and check the Location field to find the path.
Initializing a Config File (--init-config)#
After installing F2, the first step is to generate an app-specific config from the defaults.yaml template :
f2 <app> --init-config <output.yaml>
# e.g.
f2 dy --init-config my_douyin.yaml
f2 tk --init-config my_tiktok.yaml
Both full app names (douyin, tiktok) and short aliases (dy, tk) are accepted . The command force-overwrites the target file without creating a backup — unlike --update-config, which does back up.
--init-config and --update-config are mutually exclusive; they cannot be used together .
Once generated, pass the custom config with -c:
f2 dy -c my_douyin.yaml
Cookie Configuration#
Manual (recommended)#
Copy your browser cookie and write it to the config with --update-config. The -c flag is required; the command creates a *.yaml.bak backup :
f2 dy -k "paste_cookie_here" -c app.yaml --update-config
Auto-cookie (--auto-cookie)#
Reads the cookie directly from a running browser profile. The browser must be closed first to release file locks . Supported browsers: chrome, firefox, edge, opera, opera_gx, safari, chromium, brave, vivaldi, librewolf .
f2 dy -c app.yaml --auto-cookie edge
Cookie extraction is delegated entirely to the browser_cookie3 library; F2 itself only reformats the resulting string .
⚠️ Chromium V20 Cookie Encryption Compatibility Issue#
Affected: --auto-cookie on any Chromium-based browser v128 or later (Chrome, Edge, Brave, Chromium, Opera, Vivaldi).
Root cause: Google upgraded Chromium's cookie encryption scheme to V20 as of the browser update released August 15, 2024. The browser_cookie3 library F2 depends on cannot decrypt V20-encrypted cookies.
Current status (as of 2024-12-23): A fix was proposed upstream in borisbabic/browser_cookie3#215, but it still does not fully support the latest Chromium kernel versions.
Workarounds, in order of preference:
- Update F2 to the latest version — it may include a patched
browser_cookie3dependency. - Use a non-Chromium browser for
--auto-cookie(e.g., Firefox, LibreWolf). - Downgrade the browser to before v128.
- Copy the cookie manually and use
--update-configinstead (the fully reliable fallback):
f2 tk -k "your_cookie" -c app.yaml --update-config