cookie-jar-bridge 0.2.0__tar.gz

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (48) hide show
  1. cookie_jar_bridge-0.2.0/.github/workflows/ci.yml +30 -0
  2. cookie_jar_bridge-0.2.0/.github/workflows/release.yml +53 -0
  3. cookie_jar_bridge-0.2.0/.gitignore +12 -0
  4. cookie_jar_bridge-0.2.0/CHANGELOG.md +23 -0
  5. cookie_jar_bridge-0.2.0/LICENSE +21 -0
  6. cookie_jar_bridge-0.2.0/PKG-INFO +210 -0
  7. cookie_jar_bridge-0.2.0/README.md +175 -0
  8. cookie_jar_bridge-0.2.0/cookie_jar_bridge/__init__.py +30 -0
  9. cookie_jar_bridge-0.2.0/cookie_jar_bridge/cli.py +169 -0
  10. cookie_jar_bridge-0.2.0/cookie_jar_bridge/convert.py +82 -0
  11. cookie_jar_bridge-0.2.0/cookie_jar_bridge/deal.py +15 -0
  12. cookie_jar_bridge-0.2.0/cookie_jar_bridge/merge.py +35 -0
  13. cookie_jar_bridge-0.2.0/cookie_jar_bridge/mlx.py +85 -0
  14. cookie_jar_bridge-0.2.0/cookie_jar_bridge/models.py +55 -0
  15. cookie_jar_bridge-0.2.0/cookie_jar_bridge/parsers/netscape.py +64 -0
  16. cookie_jar_bridge-0.2.0/cookie_jar_bridge/parsers/playwright.py +56 -0
  17. cookie_jar_bridge-0.2.0/cookie_jar_bridge/parsers/selenium.py +51 -0
  18. cookie_jar_bridge-0.2.0/cookie_jar_bridge/parsers/set_cookie.py +102 -0
  19. cookie_jar_bridge-0.2.0/cookie_jar_bridge/py.typed +0 -0
  20. cookie_jar_bridge-0.2.0/cookie_jar_bridge/stats.py +80 -0
  21. cookie_jar_bridge-0.2.0/cookie_jar_bridge/validate.py +181 -0
  22. cookie_jar_bridge-0.2.0/docs/AFFILIATE.md +52 -0
  23. cookie_jar_bridge-0.2.0/docs/CURL_RECIPES.md +187 -0
  24. cookie_jar_bridge-0.2.0/docs/FAQ.md +21 -0
  25. cookie_jar_bridge-0.2.0/fixtures/curl-recipes/capture.set-cookie.txt +2 -0
  26. cookie_jar_bridge-0.2.0/fixtures/curl-recipes/exports/site-a.txt +3 -0
  27. cookie_jar_bridge-0.2.0/fixtures/curl-recipes/exports/site-b.txt +4 -0
  28. cookie_jar_bridge-0.2.0/fixtures/curl-recipes/session.netscape.txt +6 -0
  29. cookie_jar_bridge-0.2.0/fixtures/curl-recipes/state.playwright.json +24 -0
  30. cookie_jar_bridge-0.2.0/fixtures/tests/data/expected/netscape-from-playwright.txt +5 -0
  31. cookie_jar_bridge-0.2.0/fixtures/tests/data/netscape/domain-mismatch.txt +2 -0
  32. cookie_jar_bridge-0.2.0/fixtures/tests/data/netscape/expired.txt +2 -0
  33. cookie_jar_bridge-0.2.0/fixtures/tests/data/netscape/sample.txt +5 -0
  34. cookie_jar_bridge-0.2.0/fixtures/tests/data/playwright-json/httponly-issue.json +14 -0
  35. cookie_jar_bridge-0.2.0/fixtures/tests/data/playwright-json/sample.json +24 -0
  36. cookie_jar_bridge-0.2.0/fixtures/tests/data/selenium/sample.json +20 -0
  37. cookie_jar_bridge-0.2.0/pyproject.toml +81 -0
  38. cookie_jar_bridge-0.2.0/tests/test_cli.py +88 -0
  39. cookie_jar_bridge-0.2.0/tests/test_convert.py +47 -0
  40. cookie_jar_bridge-0.2.0/tests/test_golden.py +40 -0
  41. cookie_jar_bridge-0.2.0/tests/test_merge.py +23 -0
  42. cookie_jar_bridge-0.2.0/tests/test_mlx.py +47 -0
  43. cookie_jar_bridge-0.2.0/tests/test_netscape.py +20 -0
  44. cookie_jar_bridge-0.2.0/tests/test_playwright.py +32 -0
  45. cookie_jar_bridge-0.2.0/tests/test_selenium.py +25 -0
  46. cookie_jar_bridge-0.2.0/tests/test_set_cookie.py +23 -0
  47. cookie_jar_bridge-0.2.0/tests/test_stats.py +36 -0
  48. cookie_jar_bridge-0.2.0/tests/test_validate.py +62 -0
@@ -0,0 +1,30 @@
1
+ name: CI
2
+
3
+ on:
4
+ pull_request:
5
+
6
+ jobs:
7
+ test:
8
+ runs-on: ubuntu-latest
9
+ strategy:
10
+ fail-fast: false
11
+ matrix:
12
+ python-version: ["3.10", "3.11", "3.12"]
13
+ steps:
14
+ - uses: actions/checkout@v4
15
+
16
+ - name: Set up Python ${{ matrix.python-version }}
17
+ uses: actions/setup-python@v5
18
+ with:
19
+ python-version: ${{ matrix.python-version }}
20
+
21
+ - name: Install package and dev deps
22
+ run: |
23
+ python -m pip install --upgrade pip
24
+ pip install -e ".[dev]"
25
+
26
+ - name: Ruff
27
+ run: ruff check .
28
+
29
+ - name: Pytest
30
+ run: pytest
@@ -0,0 +1,53 @@
1
+ name: Release
2
+
3
+ on:
4
+ push:
5
+ tags:
6
+ - "v*"
7
+
8
+ jobs:
9
+ test:
10
+ runs-on: ubuntu-latest
11
+ steps:
12
+ - uses: actions/checkout@v4
13
+
14
+ - name: Set up Python 3.12
15
+ uses: actions/setup-python@v5
16
+ with:
17
+ python-version: "3.12"
18
+
19
+ - name: Install package and dev deps
20
+ run: |
21
+ python -m pip install --upgrade pip
22
+ pip install -e ".[dev]"
23
+
24
+ - name: Ruff
25
+ run: ruff check .
26
+
27
+ - name: Pytest
28
+ run: pytest
29
+
30
+ publish:
31
+ needs: test
32
+ runs-on: ubuntu-latest
33
+ steps:
34
+ - uses: actions/checkout@v4
35
+
36
+ - name: Set up Python 3.12
37
+ uses: actions/setup-python@v5
38
+ with:
39
+ python-version: "3.12"
40
+
41
+ - name: Install build tools
42
+ run: python -m pip install --upgrade pip build twine
43
+
44
+ - name: Build
45
+ run: python -m build
46
+
47
+ - name: Twine check
48
+ run: twine check dist/*
49
+
50
+ - name: Publish to PyPI
51
+ uses: pypa/gh-action-pypi-publish@release/v1
52
+ with:
53
+ password: ${{ secrets.PYPI_API_TOKEN }}
@@ -0,0 +1,12 @@
1
+ __pycache__/
2
+ *.py[cod]
3
+ *$py.class
4
+ *.egg-info/
5
+ .eggs/
6
+ dist/
7
+ build/
8
+ .pytest_cache/
9
+ .ruff_cache/
10
+ .venv/
11
+ venv/
12
+ .env
@@ -0,0 +1,23 @@
1
+ # Changelog
2
+
3
+ ## v0.2.0 — 2026-06-11
4
+
5
+ ### Added
6
+
7
+ - `cookie-bridge stats INPUT` — domain counts and expiry histogram (`--json` supported)
8
+ - Golden fixtures under `fixtures/tests/data/` (Netscape, Playwright, Selenium)
9
+ - Validation: expired cookies, Netscape subdomain/domain mismatches, host checks (`--host`)
10
+ - httpOnly / `__Secure-` / `__Host-` semantic warnings and errors
11
+ - Actionable parse errors (`line N: expected 7 tab fields, got M`)
12
+ - GitHub Actions CI workflow (Python 3.10–3.12)
13
+ - `py.typed` marker and expanded public API exports
14
+
15
+ ### Changed
16
+
17
+ - Netscape column 2 correctly interpreted as subdomain flag (not httpOnly)
18
+ - `Cookie` model gains `include_subdomains`, `source_line`, `is_expired()`
19
+ - README format conversion matrix (Netscape ↔ Playwright ↔ Selenium ↔ curl)
20
+
21
+ ## v0.1.0 — 2026-06-01
22
+
23
+ - Initial release: convert, validate, merge, optional MLX import
@@ -0,0 +1,21 @@
1
+ MIT License
2
+
3
+ Copyright (c) 2026 cookie-jar-bridge contributors
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ of this software and associated documentation files (the "Software"), to deal
7
+ in the Software without restriction, including without limitation the rights
8
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ copies of the Software, and to permit persons to whom the Software is
10
+ furnished to do so, subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in all
13
+ copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
+ SOFTWARE.
@@ -0,0 +1,210 @@
1
+ Metadata-Version: 2.4
2
+ Name: cookie-jar-bridge
3
+ Version: 0.2.0
4
+ Summary: Stop hand-editing cookies.txt — convert Netscape, Playwright, Selenium, and Set-Cookie formats in one CLI.
5
+ Project-URL: Homepage, https://github.com/cookie-jar-bridge/cookie-jar-bridge
6
+ Project-URL: Documentation, https://github.com/cookie-jar-bridge/cookie-jar-bridge#readme
7
+ Project-URL: Repository, https://github.com/cookie-jar-bridge/cookie-jar-bridge
8
+ Project-URL: Issues, https://github.com/cookie-jar-bridge/cookie-jar-bridge/issues
9
+ Author: cookie-jar-bridge contributors
10
+ License-Expression: MIT
11
+ License-File: LICENSE
12
+ Keywords: browser-cookies,cookie-converter,cookie-format,cookie-jar,cookie-merge,cookie-validator,curl-cookies,http-cookie,netscape-cookies,playwright-cookies,selenium-cookies,set-cookie
13
+ Classifier: Development Status :: 4 - Beta
14
+ Classifier: Intended Audience :: Developers
15
+ Classifier: License :: OSI Approved :: MIT License
16
+ Classifier: Programming Language :: Python :: 3
17
+ Classifier: Programming Language :: Python :: 3.10
18
+ Classifier: Programming Language :: Python :: 3.11
19
+ Classifier: Programming Language :: Python :: 3.12
20
+ Classifier: Programming Language :: Python :: 3.13
21
+ Classifier: Topic :: Internet :: WWW/HTTP :: Browsers
22
+ Classifier: Typing :: Typed
23
+ Requires-Python: >=3.10
24
+ Requires-Dist: click>=8.1
25
+ Provides-Extra: dev
26
+ Requires-Dist: build>=1.2; extra == 'dev'
27
+ Requires-Dist: httpx>=0.27; extra == 'dev'
28
+ Requires-Dist: pytest-httpx>=0.34; extra == 'dev'
29
+ Requires-Dist: pytest>=8.0; extra == 'dev'
30
+ Requires-Dist: ruff>=0.8; extra == 'dev'
31
+ Requires-Dist: twine>=5.0; extra == 'dev'
32
+ Provides-Extra: mlx
33
+ Requires-Dist: httpx>=0.27; extra == 'mlx'
34
+ Description-Content-Type: text/markdown
35
+
36
+ # cookie-jar-bridge
37
+
38
+ Python 3.10+ | MLX optional · [Compatibility](../packages/COMPATIBILITY.md)
39
+
40
+ Convert and validate browser cookies across **Netscape** (`cookies.txt`), **Playwright** storage state JSON, **Selenium** cookie dict lists, and raw **HTTP Set-Cookie** headers.
41
+
42
+ Pure Python — no browser required for convert, validate, or merge.
43
+
44
+ ## Problem
45
+
46
+ Cookie exports arrive in incompatible shapes:
47
+
48
+ - `curl` / browser extensions → Netscape `cookies.txt`
49
+ - Playwright → `storage_state.json` with `cookies` + `origins`
50
+ - Selenium → list of `{"name", "value", "domain", ...}` dicts
51
+ - HTTP traces → `Set-Cookie:` header lines
52
+
53
+ Teams waste time hand-editing tab-separated files or writing one-off scripts. `cookie-bridge` normalizes to a canonical model and writes any supported output format.
54
+
55
+ ## pip install
56
+
57
+ ```bash
58
+ pip install cookie-jar-bridge
59
+ ```
60
+
61
+ MLX profile import (unlock + Launcher API):
62
+
63
+ ```bash
64
+ pip install cookie-jar-bridge[mlx]
65
+ ```
66
+
67
+ ## Quick start
68
+
69
+ ```bash
70
+ # Playwright storage state -> Netscape (for curl, wget, legacy tools)
71
+ cookie-bridge convert state.json --to netscape -o cookies.txt
72
+
73
+ # Netscape -> Playwright storage state
74
+ cookie-bridge convert cookies.txt --to playwright-json -o state.json
75
+
76
+ # Validate a jar before use
77
+ cookie-bridge validate cookies.txt
78
+
79
+ # Merge exports from a folder (later files win on duplicates)
80
+ cookie-bridge merge ./exports/ -o merged.txt
81
+ ```
82
+
83
+ ```python
84
+ from cookie_jar_bridge import load_cookies, convert_cookies
85
+
86
+ cookies = load_cookies(open("cookies.txt").read())
87
+ open("state.json", "w").write(convert_cookies(cookies, "playwright-json"))
88
+ ```
89
+
90
+ ## CLI
91
+
92
+ | Command | Description |
93
+ |---------|-------------|
94
+ | `cookie-bridge convert INPUT --to FORMAT -o OUT` | Convert between formats |
95
+ | `cookie-bridge validate INPUT` | Structural + semantic checks (`--host` for domain match) |
96
+ | `cookie-bridge stats INPUT` | Domain counts + expiry histogram |
97
+ | `cookie-bridge merge DIR/ -o OUT` | Merge `.txt`/`.json` cookie files |
98
+ | `cookie-bridge mlx-import --profile-id UUID --input FILE` | MLX unlock + import (`[mlx]`) |
99
+
100
+ ### Format conversion matrix
101
+
102
+ | From ↓ / To → | Netscape (`curl -b`) | Playwright JSON | Selenium JSON | Set-Cookie lines |
103
+ |---------------|----------------------|-----------------|---------------|------------------|
104
+ | **Netscape** | — | `convert --to playwright-json` | `convert --to selenium-json` | `convert --to set-cookie` |
105
+ | **Playwright** | `convert --to netscape` | — | via Netscape or direct JSON | `convert --to set-cookie` |
106
+ | **Selenium** | `convert --to netscape` | `convert --to playwright-json` | — | `convert --to set-cookie` |
107
+ | **Set-Cookie** | `convert --to netscape` | `convert --to playwright-json` | `convert --to selenium-json` | — |
108
+
109
+ | `--to` / auto-detect | Description |
110
+ |----------------------|-------------|
111
+ | `netscape` | Tab-separated `cookies.txt` (curl-compatible) |
112
+ | `playwright-json` | Playwright `storage_state` object |
113
+ | `selenium-json` | JSON array of Selenium cookie dicts |
114
+ | `set-cookie` | `Set-Cookie:` header lines |
115
+
116
+ Use `--from FORMAT` to override auto-detection.
117
+
118
+ `validate` checks expired cookies, Netscape subdomain/domain flag mismatches, optional `--host example.com`, and httpOnly issues on secure session-like cookies.
119
+
120
+ ### Exit codes
121
+
122
+ | Code | Meaning |
123
+ |------|---------|
124
+ | `0` | Success |
125
+ | `1` | Validation failed (`validate`) or `--strict` warnings |
126
+ | `2` | Runtime error |
127
+
128
+ ## API
129
+
130
+ | Symbol | Description |
131
+ |--------|-------------|
132
+ | `load_cookies(text, fmt=None)` | Parse any supported format |
133
+ | `detect_format(text)` | Auto-detect source format |
134
+ | `convert_cookies(cookies, target)` | Serialize to target format |
135
+ | `validate_text(text)` | Return `ValidationReport` |
136
+ | `merge_directory(path)` | Merge files → `list[Cookie]` |
137
+
138
+ ## MLX import (`[mlx]` extra)
139
+
140
+ Imports cookies into a Multilogin X profile:
141
+
142
+ 1. **Unlock** profile via Cloud API `GET /profile/unlock?profile_ids=UUID`
143
+ 2. **Import** via Launcher `POST /api/v1/cookies/import`
144
+
145
+ ```bash
146
+ export MLX_TOKEN="your-bearer-token"
147
+ cookie-bridge mlx-import --profile-id PROFILE_UUID --input cookies.txt
148
+ ```
149
+
150
+ Requires the Multilogin desktop agent running locally.
151
+
152
+ ## Limitations
153
+
154
+ - **No live browser sync** — converts static files only; does not read Chrome SQLite or Firefox `cookies.sqlite` directly.
155
+ - **Domain inference** — Set-Cookie lines without `Domain=` may produce cookies missing domain until you add it manually.
156
+ - **Merge scope** — `merge` reads `.txt`, `.json`, `.cookies` in one directory; no recursive subfolders.
157
+ - **MLX import** — Launcher must be running; encrypted profiles must unlock successfully before import.
158
+ - **Not a security audit** — validation checks structure, not cookie secrecy or theft risk.
159
+
160
+ ## Production
161
+
162
+ Partner offers, eligibility, and disclosure: [docs/AFFILIATE.md](docs/AFFILIATE.md).
163
+
164
+ For production antidetect workflows, convert cookies to the format your stack expects, validate before import, then push to isolated profiles:
165
+
166
+ ```bash
167
+ cookie-bridge convert export.json --to netscape -o clean.txt
168
+ cookie-bridge validate clean.txt --strict
169
+ cookie-bridge mlx-import --profile-id "$PROFILE_ID" --input clean.txt
170
+ ```
171
+
172
+ Pair with [playwright-cdp-probe](https://github.com/playwright-cdp-probe/playwright-cdp-probe) to audit the session after import.
173
+
174
+ ## Guides
175
+
176
+ Monorepo playbooks (copy-paste commands, sample output, diagrams):
177
+
178
+ | Guide | Flow |
179
+ |-------|------|
180
+ | [Detection fail → MLX farm](../packages/docs/workflows/WORKFLOW_DETECTED.md) | `cdp-probe` → `cdp-connect` → `farm-runner mlx-pool` |
181
+ | [Competitor migration](../packages/docs/workflows/WORKFLOW_MIGRATION.md) | `antidetect-import` → `profile-factory mlx-create` |
182
+ | [Proxy lane → profile pool](../packages/docs/workflows/WORKFLOW_FARM.md) | `proxy-lane` → `profile-factory` → `farm-runner mlx-pool` |
183
+
184
+ **FAQ:** [docs/FAQ.md](docs/FAQ.md) — Netscape cookies, Playwright JSON, merge formats.
185
+
186
+ **curl / requests:** [docs/CURL_RECIPES.md](docs/CURL_RECIPES.md) — Netscape → `curl -b`, Playwright state → `requests.Session` (5 copy-paste recipes).
187
+
188
+ ## Related tools
189
+
190
+ | Tool | Use with |
191
+ |------|----------|
192
+ | [playwright-cdp-probe](../playwright-cdp-probe/) — Score CDP/WebDriver exposure and fingerprint leaks | → [cdp-connect-kit](../cdp-connect-kit/) when probe fails |
193
+ | [cookie-jar-bridge](../cookie-jar-bridge/) — Convert, validate, and merge cookies across formats | → [session-bundle-kit](../session-bundle-kit/) for full session |
194
+ | [proxy-lane-checker](../proxy-lane-checker/) — Batch-check proxies for connectivity, geo, and DNSBL | → [profile-yaml-factory](../profile-yaml-factory/) |
195
+ | [fingerprint-coherence](../fingerprint-coherence/) — Lint fingerprints for cross-signal contradictions | → [profile-yaml-factory](../profile-yaml-factory/) before create |
196
+ | [human-input-kit](../human-input-kit/) — Human-like mouse, scroll, and warmup replay | → [automation-farm-runner](../automation-farm-runner/) |
197
+ | [cdp-connect-kit](../cdp-connect-kit/) — Playwright CDP connect; MLX start/stop helpers | → all packages needing CDP |
198
+ | [session-bundle-kit](../session-bundle-kit/) — Export/import cookies and storage as portable bundles | → [cookie-jar-bridge](../cookie-jar-bridge/) |
199
+ | [profile-yaml-factory](../profile-yaml-factory/) — YAML blueprints → MLX `profile/create` payloads | → [antidetect-importer](../antidetect-importer/) after migration |
200
+ | [antidetect-importer](../antidetect-importer/) — Parse competitor exports and push to MLX | → [profile-yaml-factory](../profile-yaml-factory/) |
201
+ | [automation-farm-runner](../automation-farm-runner/) — YAML job queue and MLX profile-pool runner | → [cdp-connect-kit](../cdp-connect-kit/) `[mlx]` |
202
+
203
+ ## License
204
+
205
+ MIT
206
+
207
+ ---
208
+
209
+ **Production antidetect:** [Multilogin X](https://multilogin.com/?ref=SAAS50) · Code `SAAS50` (-50% browser) · `MIN50` (-50% cloud phone)
210
+ More scripts: [@Multilogin_Scripts_Bot](https://t.me/Multilogin_Scripts_Bot) · [Coupons](https://anti-detect.github.io/)
@@ -0,0 +1,175 @@
1
+ # cookie-jar-bridge
2
+
3
+ Python 3.10+ | MLX optional · [Compatibility](../packages/COMPATIBILITY.md)
4
+
5
+ Convert and validate browser cookies across **Netscape** (`cookies.txt`), **Playwright** storage state JSON, **Selenium** cookie dict lists, and raw **HTTP Set-Cookie** headers.
6
+
7
+ Pure Python — no browser required for convert, validate, or merge.
8
+
9
+ ## Problem
10
+
11
+ Cookie exports arrive in incompatible shapes:
12
+
13
+ - `curl` / browser extensions → Netscape `cookies.txt`
14
+ - Playwright → `storage_state.json` with `cookies` + `origins`
15
+ - Selenium → list of `{"name", "value", "domain", ...}` dicts
16
+ - HTTP traces → `Set-Cookie:` header lines
17
+
18
+ Teams waste time hand-editing tab-separated files or writing one-off scripts. `cookie-bridge` normalizes to a canonical model and writes any supported output format.
19
+
20
+ ## pip install
21
+
22
+ ```bash
23
+ pip install cookie-jar-bridge
24
+ ```
25
+
26
+ MLX profile import (unlock + Launcher API):
27
+
28
+ ```bash
29
+ pip install cookie-jar-bridge[mlx]
30
+ ```
31
+
32
+ ## Quick start
33
+
34
+ ```bash
35
+ # Playwright storage state -> Netscape (for curl, wget, legacy tools)
36
+ cookie-bridge convert state.json --to netscape -o cookies.txt
37
+
38
+ # Netscape -> Playwright storage state
39
+ cookie-bridge convert cookies.txt --to playwright-json -o state.json
40
+
41
+ # Validate a jar before use
42
+ cookie-bridge validate cookies.txt
43
+
44
+ # Merge exports from a folder (later files win on duplicates)
45
+ cookie-bridge merge ./exports/ -o merged.txt
46
+ ```
47
+
48
+ ```python
49
+ from cookie_jar_bridge import load_cookies, convert_cookies
50
+
51
+ cookies = load_cookies(open("cookies.txt").read())
52
+ open("state.json", "w").write(convert_cookies(cookies, "playwright-json"))
53
+ ```
54
+
55
+ ## CLI
56
+
57
+ | Command | Description |
58
+ |---------|-------------|
59
+ | `cookie-bridge convert INPUT --to FORMAT -o OUT` | Convert between formats |
60
+ | `cookie-bridge validate INPUT` | Structural + semantic checks (`--host` for domain match) |
61
+ | `cookie-bridge stats INPUT` | Domain counts + expiry histogram |
62
+ | `cookie-bridge merge DIR/ -o OUT` | Merge `.txt`/`.json` cookie files |
63
+ | `cookie-bridge mlx-import --profile-id UUID --input FILE` | MLX unlock + import (`[mlx]`) |
64
+
65
+ ### Format conversion matrix
66
+
67
+ | From ↓ / To → | Netscape (`curl -b`) | Playwright JSON | Selenium JSON | Set-Cookie lines |
68
+ |---------------|----------------------|-----------------|---------------|------------------|
69
+ | **Netscape** | — | `convert --to playwright-json` | `convert --to selenium-json` | `convert --to set-cookie` |
70
+ | **Playwright** | `convert --to netscape` | — | via Netscape or direct JSON | `convert --to set-cookie` |
71
+ | **Selenium** | `convert --to netscape` | `convert --to playwright-json` | — | `convert --to set-cookie` |
72
+ | **Set-Cookie** | `convert --to netscape` | `convert --to playwright-json` | `convert --to selenium-json` | — |
73
+
74
+ | `--to` / auto-detect | Description |
75
+ |----------------------|-------------|
76
+ | `netscape` | Tab-separated `cookies.txt` (curl-compatible) |
77
+ | `playwright-json` | Playwright `storage_state` object |
78
+ | `selenium-json` | JSON array of Selenium cookie dicts |
79
+ | `set-cookie` | `Set-Cookie:` header lines |
80
+
81
+ Use `--from FORMAT` to override auto-detection.
82
+
83
+ `validate` checks expired cookies, Netscape subdomain/domain flag mismatches, optional `--host example.com`, and httpOnly issues on secure session-like cookies.
84
+
85
+ ### Exit codes
86
+
87
+ | Code | Meaning |
88
+ |------|---------|
89
+ | `0` | Success |
90
+ | `1` | Validation failed (`validate`) or `--strict` warnings |
91
+ | `2` | Runtime error |
92
+
93
+ ## API
94
+
95
+ | Symbol | Description |
96
+ |--------|-------------|
97
+ | `load_cookies(text, fmt=None)` | Parse any supported format |
98
+ | `detect_format(text)` | Auto-detect source format |
99
+ | `convert_cookies(cookies, target)` | Serialize to target format |
100
+ | `validate_text(text)` | Return `ValidationReport` |
101
+ | `merge_directory(path)` | Merge files → `list[Cookie]` |
102
+
103
+ ## MLX import (`[mlx]` extra)
104
+
105
+ Imports cookies into a Multilogin X profile:
106
+
107
+ 1. **Unlock** profile via Cloud API `GET /profile/unlock?profile_ids=UUID`
108
+ 2. **Import** via Launcher `POST /api/v1/cookies/import`
109
+
110
+ ```bash
111
+ export MLX_TOKEN="your-bearer-token"
112
+ cookie-bridge mlx-import --profile-id PROFILE_UUID --input cookies.txt
113
+ ```
114
+
115
+ Requires the Multilogin desktop agent running locally.
116
+
117
+ ## Limitations
118
+
119
+ - **No live browser sync** — converts static files only; does not read Chrome SQLite or Firefox `cookies.sqlite` directly.
120
+ - **Domain inference** — Set-Cookie lines without `Domain=` may produce cookies missing domain until you add it manually.
121
+ - **Merge scope** — `merge` reads `.txt`, `.json`, `.cookies` in one directory; no recursive subfolders.
122
+ - **MLX import** — Launcher must be running; encrypted profiles must unlock successfully before import.
123
+ - **Not a security audit** — validation checks structure, not cookie secrecy or theft risk.
124
+
125
+ ## Production
126
+
127
+ Partner offers, eligibility, and disclosure: [docs/AFFILIATE.md](docs/AFFILIATE.md).
128
+
129
+ For production antidetect workflows, convert cookies to the format your stack expects, validate before import, then push to isolated profiles:
130
+
131
+ ```bash
132
+ cookie-bridge convert export.json --to netscape -o clean.txt
133
+ cookie-bridge validate clean.txt --strict
134
+ cookie-bridge mlx-import --profile-id "$PROFILE_ID" --input clean.txt
135
+ ```
136
+
137
+ Pair with [playwright-cdp-probe](https://github.com/playwright-cdp-probe/playwright-cdp-probe) to audit the session after import.
138
+
139
+ ## Guides
140
+
141
+ Monorepo playbooks (copy-paste commands, sample output, diagrams):
142
+
143
+ | Guide | Flow |
144
+ |-------|------|
145
+ | [Detection fail → MLX farm](../packages/docs/workflows/WORKFLOW_DETECTED.md) | `cdp-probe` → `cdp-connect` → `farm-runner mlx-pool` |
146
+ | [Competitor migration](../packages/docs/workflows/WORKFLOW_MIGRATION.md) | `antidetect-import` → `profile-factory mlx-create` |
147
+ | [Proxy lane → profile pool](../packages/docs/workflows/WORKFLOW_FARM.md) | `proxy-lane` → `profile-factory` → `farm-runner mlx-pool` |
148
+
149
+ **FAQ:** [docs/FAQ.md](docs/FAQ.md) — Netscape cookies, Playwright JSON, merge formats.
150
+
151
+ **curl / requests:** [docs/CURL_RECIPES.md](docs/CURL_RECIPES.md) — Netscape → `curl -b`, Playwright state → `requests.Session` (5 copy-paste recipes).
152
+
153
+ ## Related tools
154
+
155
+ | Tool | Use with |
156
+ |------|----------|
157
+ | [playwright-cdp-probe](../playwright-cdp-probe/) — Score CDP/WebDriver exposure and fingerprint leaks | → [cdp-connect-kit](../cdp-connect-kit/) when probe fails |
158
+ | [cookie-jar-bridge](../cookie-jar-bridge/) — Convert, validate, and merge cookies across formats | → [session-bundle-kit](../session-bundle-kit/) for full session |
159
+ | [proxy-lane-checker](../proxy-lane-checker/) — Batch-check proxies for connectivity, geo, and DNSBL | → [profile-yaml-factory](../profile-yaml-factory/) |
160
+ | [fingerprint-coherence](../fingerprint-coherence/) — Lint fingerprints for cross-signal contradictions | → [profile-yaml-factory](../profile-yaml-factory/) before create |
161
+ | [human-input-kit](../human-input-kit/) — Human-like mouse, scroll, and warmup replay | → [automation-farm-runner](../automation-farm-runner/) |
162
+ | [cdp-connect-kit](../cdp-connect-kit/) — Playwright CDP connect; MLX start/stop helpers | → all packages needing CDP |
163
+ | [session-bundle-kit](../session-bundle-kit/) — Export/import cookies and storage as portable bundles | → [cookie-jar-bridge](../cookie-jar-bridge/) |
164
+ | [profile-yaml-factory](../profile-yaml-factory/) — YAML blueprints → MLX `profile/create` payloads | → [antidetect-importer](../antidetect-importer/) after migration |
165
+ | [antidetect-importer](../antidetect-importer/) — Parse competitor exports and push to MLX | → [profile-yaml-factory](../profile-yaml-factory/) |
166
+ | [automation-farm-runner](../automation-farm-runner/) — YAML job queue and MLX profile-pool runner | → [cdp-connect-kit](../cdp-connect-kit/) `[mlx]` |
167
+
168
+ ## License
169
+
170
+ MIT
171
+
172
+ ---
173
+
174
+ **Production antidetect:** [Multilogin X](https://multilogin.com/?ref=SAAS50) · Code `SAAS50` (-50% browser) · `MIN50` (-50% cloud phone)
175
+ More scripts: [@Multilogin_Scripts_Bot](https://t.me/Multilogin_Scripts_Bot) · [Coupons](https://anti-detect.github.io/)
@@ -0,0 +1,30 @@
1
+ """Cookie format conversion and validation toolkit."""
2
+
3
+ from cookie_jar_bridge.convert import (
4
+ convert_cookies,
5
+ detect_format,
6
+ load_cookies,
7
+ read_file,
8
+ write_file,
9
+ )
10
+ from cookie_jar_bridge.merge import merge_directory_to_netscape
11
+ from cookie_jar_bridge.models import Cookie, CookieFormat
12
+ from cookie_jar_bridge.stats import CookieStats, compute_stats
13
+ from cookie_jar_bridge.validate import ValidationIssue, ValidationReport, validate_text
14
+
15
+ __all__ = [
16
+ "Cookie",
17
+ "CookieFormat",
18
+ "CookieStats",
19
+ "ValidationIssue",
20
+ "ValidationReport",
21
+ "compute_stats",
22
+ "convert_cookies",
23
+ "detect_format",
24
+ "load_cookies",
25
+ "merge_directory_to_netscape",
26
+ "read_file",
27
+ "validate_text",
28
+ "write_file",
29
+ ]
30
+ __version__ = "0.2.0"