Universal Cookie Management System
Overview
The /api/fileupload endpoint supports automatic detection and organization of single-domain cookie files. Cookies are stored as hidden files (with leading dot) for better security and privacy.
Features
✅ Single-Domain Only: Each cookie file must contain cookies for one domain only
✅ Hidden Files: All cookies saved with leading dot (.youtube.com.cookie, .leboncoin.fr.cookie)
✅ Auto-Detection: Recognizes Netscape HTTP Cookie File format
✅ Domain Extraction: Parses cookie content to identify the source domain
✅ MULTIPASS Compatible: Cookies stored in EMAIL-based MULTIPASS directories
❌ No Multi-Domain: Multi-domain cookie files are rejected (export per-domain cookies)
Directory Structure
~/.zen/game/nostr/user@email.com/ # EMAIL-based directory (created by make_NOSTRCARD.sh)
├── .youtube.com.cookie # YouTube cookies only (single-domain, hidden file)
├── .leboncoin.fr.cookie # Leboncoin cookies only (single-domain, hidden file)
├── .amazon.fr.cookie # Amazon cookies only (single-domain, hidden file)
├── .[domain].cookie # Any single domain cookie (hidden file)
├── NPUB # NOSTR public key (npub1..., stored as file)
├── HEX # NOSTR public key (hex format, stored as file)
├── .secret.nostr # NOSTR private key (nsec, npub, hex - hidden)
└── APP/
└── uDRIVE/
├── Videos/ # Downloaded videos
└── Music/ # Downloaded musicNotes:
.{domain}.cookie→ Single-domain cookies ONLY (e.g., youtube.com + subdomains)All cookie files are hidden files (starting with dot) at the root of user's EMAIL directory
Directory is always EMAIL-based, NPUB/HEX are stored as files inside
Multi-domain cookies are NOT supported - export cookies separately for each domain
Cookie File Format
Supported format:
Netscape HTTP Cookie File (ONLY format accepted)
Single-domain only - cookies must be for one domain and its subdomains
Cookie File Types:
Single-Domain Cookies (ONLY accepted type)
Each uploaded file must contain cookies for one domain only (and its subdomains):
.youtube.com.cookie→ All cookies for youtube.com and subdomains.leboncoin.fr.cookie→ All cookies for leboncoin.fr and subdomains
❌ Multi-Domain Cookies (REJECTED)
Files containing cookies for multiple different domains are rejected with an error message.
Solution: Export cookies separately for each domain using your browser extension's filter options.
Example Netscape format:
Upload Cookie
Via API
Response Examples
Single-Domain Cookie:
❌ Multi-Domain Cookie (Error):f
Status Code: 400 Bad Request
Automated Scraper Execution
System Architecture
The UPlanet system includes an extensible domain-based scraper framework that automatically executes scrapers when cookies are detected.
How It Works
Cookie Upload: User uploads cookie via
/api/fileuploador/cookieinterfaceDomain Detection: System extracts primary domain (e.g.,
youtube.com,leboncoin.fr)File Storage: Cookie saved as
.DOMAIN.cookiein user's MULTIPASS directory with permissions 600Daily Scan: During MULTIPASS refresh (
NOSTRCARD.refresh.sh), system scans for all.*.cookiefilesScraper Lookup: For each cookie, system looks for
DOMAIN.shscript inAstroport.ONE/IA/Execution: If found, script runs with user's email and cookie file path as arguments (once per day)
Notification: If not found, user receives email explaining how to request a custom scraper (once per domain)
Naming Convention for Scrapers
Scraper Scripts:
Format:
DOMAIN.sh(bash script run by AstrBot)Location:
Astroport.ONE/IA/Examples:
youtube.com.sh→ YouTube scraperleboncoin.fr.sh→ Leboncoin scrapertwitter.com.sh→ Twitter scraper (etc...)
Python Backend (optional):
Format:
scraper_DOMAIN.pyLocation:
Astroport.ONE/IA/Called by bash script if complex logic required
User Notifications
When a cookie is uploaded for a domain without a scraper:
User receives email: "🍪 Cookie: DOMAIN - MISSING ASTROBOT PROGRAM"
Email explains how to request a custom scraper via Captain
Notification sent only once per domain (tracked in
.DOMAIN_notifiedfile)Smart contract workflow: User describes needs → Captain validates → Script added to codebase
Execution Tracking
To prevent multiple executions per day:
Each scraper execution creates a
.donefile:~/.zen/tmp/${DOMAIN}_sync_${PLAYER}_${TODATE}.doneIf
.donefile exists for today, scraper is skippedLogs are stored in:
~/.zen/tmp/${DOMAIN}_sync_${PLAYER}.log
See DOMAIN_SCRAPERS.md for detailed instructions on creating custom scrapers.
Using Cookies
1. YouTube Sync (automatic)
Note: Now handled automatically by NOSTRCARD.refresh.sh when .youtube.com.cookie is detected.
Manual execution:
Searches for:
~/.zen/game/nostr/user@email.com/.youtube.com.cookie(domain-specific cookie)
2. Leboncoin Scraper (automatic)
Note: Now handled automatically by NOSTRCARD.refresh.sh when .leboncoin.fr.cookie is detected.
Manual execution:
Or call Python scraper directly:
3. Generic Cookie Helper
Supported Services
YouTube
.youtube.com.cookie
youtube.com.sh
(uses yt-dlp + process_youtube.sh)
Leboncoin
.leboncoin.fr.cookie
leboncoin.fr.sh
scraper_leboncoin.py
Any Domain
.{domain}.cookie
Create {domain}.sh
Optional scraper_{domain}.py
All files are stored in ~/.zen/game/nostr/EMAIL/ directory
Extensible System:
Add
DOMAIN.shscript toAstroport.ONE/IA/directorySystem automatically detects and executes it
No code changes required in main system
See
DOMAIN_SCRAPERS.mdfor instructions
Security
🔒 Security Features:
Cookies are NOT published to IPFS
Stored in user's private directory (not in uDRIVE)
NIP-42 authentication required for upload
Hidden files (leading dot) for extra privacy
File permissions: 600 (read/write for owner only) - Set automatically on save
⚠️ Best Practices:
Never share cookie files publicly
Regenerate cookies periodically
Use browser extensions to export cookies safely
Check cookie expiration dates
Use HTTPS-only cookies when possible
MULTIPASS Access
All MULTIPASS identities are created by make_NOSTRCARD.sh and stored in EMAIL-based directories:
Important:
Directory structure is always based on EMAIL (e.g.,
user@email.com)NPUB/HEX are stored as files inside the EMAIL directory
There is NO separate directory for NPUB
All services access cookies via the EMAIL path
Only single-domain cookie files (
.DOMAIN.cookie) are supported
Extending to New Services
To add support for a new website:
Upload the cookie file for ONE domain only (via
/api/fileupload)System auto-detects the domain (e.g.,
amazon.fr→.amazon.fr.cookie)Use in your scripts:
Best Practices
How to Export Single-Domain Cookies
When using "Get cookies.txt LOCALLY" extension:
Open the website you want to export cookies for
Click the extension icon
Filter by current site (usually done automatically)
Select Netscape format
Export - this creates a single-domain cookie file
Upload to UPlanet
Important: Export cookies separately for each domain you want to use. Don't export all browser cookies at once.
API Endpoints
Upload File with Cookie Detection
Endpoint:
POST /api/fileuploadAuth: NIP-42 (npub required)
Params:
file: Cookie file (.txt with Netscape format)npub: User's NOSTR public key
Returns: Cookie details with detected domain
Helper Scripts
get_cookie.sh
Find cookie file for a domain
youtube.com.sh
Auto-sync YouTube liked videos
leboncoin.fr.sh
Scrape Leboncoin ads
scraper_leboncoin.py
Python backend for Leboncoin
Troubleshooting
Cookie not found
Cookie expired
Most cookies have expiration dates. If services fail with auth errors:
Export fresh cookies from your browser
Re-upload via
/api/fileuploadSystem will automatically replace old cookie
Domain not detected
If domain detection fails, the system saves as .cookie.txt in the user's EMAIL directory. You can manually rename it:
Browser Extensions for Cookie Export
Recommended extensions to export cookies in Netscape format:
Chrome/Edge: "Get cookies.txt LOCALLY"
Firefox: "cookies.txt"
Any Browser: Developer Tools → Application → Cookies (manual export)
Example: Adding New Service
Let's add support for Twitter/X:
Future Enhancements
Planned features:
Documentation: UPassport Cookie System v1.0 Last Updated: Décembre 2025 Maintainer: Astroport.ONE Team
Related Documentation
COOKIE_SYSTEM_COMPLIANCE.md: Detailed conformity analysis between documentation and implementation
NOSTRCARD.refresh.sh: Automated scraper execution script
cookie.html: User interface for cookie upload
Documentation: UPassport Cookie System v1.0 Last Updated: Décembre 2025 Maintainer: Astroport.ONE Team
Related Documentation
COOKIE_SYSTEM_COMPLIANCE.md: Detailed conformity analysis between documentation and implementation
NOSTRCARD.refresh.sh: Automated scraper execution script
cookie.html: User interface for cookie upload
Documentation: UPassport Cookie System v1.0 Last Updated: Décembre 2025 Maintainer: Astroport.ONE Team
Last updated