🍪 Social Cookie Jar
Headless social media automation toolkit for AI agents. Cookie-based auth, paste-and-send pattern, zero typing detection.
Supported Platforms
| Platform | Feed | Post | Comment | Reply | Like |
|---|---|---|---|---|---|
| ✅ | ✅ | ✅ | — | — | |
| Twitter/X | ✅ | ✅ | — | ✅ | — |
| ✅ | ✅ | ✅ | — | — | |
| ✅ | ✅ | ✅ | — | — | |
| Discord | ✅ | — | — | — | — |
| ✅ | — | ✅ | — | ✅ | |
| Hacker News | ✅ | ✅ | ✅ | — | — |
| Substack | ✅ | — | ✅ | — | — |
| PyPI | — | — | — | — | — |
How It Works
- Login once in a real browser (or use the CDP cookie export)
- Export cookies to a pickle/JSON file
- Selenium loads cookies — no login flow, no 2FA, no CAPTCHA
- Paste-and-send — text is pasted via
ClipboardEvent, not typed character by character. Instant and indistinguishable from human behavior.
Install
pip install social-cookie-jar
# or
pip install -e .
Requires: Python 3.10+, Chrome/Chromium, ChromeDriver
Quick Start
Export cookies from a running browser (CDP)
from social_cookie_jar import export_from_cdp
# From an OpenClaw/Playwright/Puppeteer browser with CDP enabled
export_from_cdp("ws://127.0.0.1:9222/devtools/page/TARGET_ID", "facebook", "./cookies")
Use a driver
from social_cookie_jar import TwitterDriver
with TwitterDriver(cookie_dir="./cookies") as tw:
if tw.login():
tw.post("Hello from an AI agent 🤖")
for tweet in tw.feed():
print(tweet.text[:100])
tw.reply("https://x.com/user/status/123", "Great thread!")
CLI
# Login check
python -m social_cookie_jar login twitter
# Post
python -m social_cookie_jar post twitter "Hello world"
python -m social_cookie_jar post facebook "My first post"
# Read feeds
python -m social_cookie_jar feed reddit LocalLLaMA
python -m social_cookie_jar feed hackernews
# Comment
python -m social_cookie_jar comment facebook https://fb.com/post/123 "Nice post!"
python -m social_cookie_jar reply twitter https://x.com/user/status/123 "Interesting!"
# Submit to HN
python -m social_cookie_jar submit hackernews "Show HN: My Project" --url https://myproject.com
# Export cookies
python -m social_cookie_jar export-cookies facebook --cdp-url ws://127.0.0.1:9222/devtools/page/ID
python -m social_cookie_jar export-cookies twitter --json-file cookies.json
Architecture
social_cookie_jar/
├── __init__.py # Package exports
├── __main__.py # CLI entry point
├── cookie_jar.py # CookieJar — save/load/inject cookies (pickle + JSON)
├── export.py # CDP, Playwright, JSON, Netscape cookie import
└── drivers/
├── __init__.py # BaseDriver — shared Selenium utilities + paste pattern
├── facebook.py # FacebookDriver
├── twitter.py # TwitterDriver
├── linkedin.py # LinkedInDriver
├── reddit.py # RedditDriver
├── discord.py # DiscordDriver
├── instagram.py # InstagramDriver
├── hackernews.py # HackerNewsDriver
├── substack.py # SubstackDriver
└── pypi.py # PyPIDriver
Key Design Decisions
- Cookie-based auth — no passwords stored or typed into browsers. Export cookies once from a real session, reuse forever (until they expire).
- Paste, don't type —
ClipboardEventpaste is instant and bypasses typing-speed heuristics. This is how humans actually work (Ctrl+V). - Platform-specific drivers — each platform has its own CSS selectors and flow. No generic "just find a textbox" approach.
- Headless by default — no GUI needed. Perfect for servers, CI, AI agent runtimes.
Cookie Refresh
Cookies expire (typically 30-90 days). When they do:
- Login manually in a regular browser
- Re-export cookies:
python -m social_cookie_jar export-cookies <platform> --cdp-url <url> - Selenium picks up new cookies automatically
For AI Agents
This toolkit is designed for AI agents that need social media presence. See llms.txt in this repo for AI-specific guidance.
Separation pattern: Use your host browser for human accounts, and Social Cookie Jar (Selenium) for the agent's own accounts. Never mix sessions.
License
MIT — see LICENSE
Release files for social-cookie-jar 0.2.0
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | |
|---|---|---|---|
| social_cookie_jar-0.2.0.tar.gz | 17.3 kB | Details |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Reset |
|---|---|---|---|---|
| social_cookie_jar-0.2.0-py3-none-any.whl | Python 3 | none | any | Details |
Total release size: 41.2 kB
Release files / social_cookie_jar-0.2.0.tar.gz
How to use checksums
8d4a34f64ba454beb27ad5b411218072f935ccd97736c0b9a385f58290e77543How to use checksums
245a14d8bea03a865a44b8df60ea96e5728926a5bb7f36dcc37cff3a77356effWhat is trusted publishing?
twine/6.2.0 CPython/3.13.11