Skip to content
For the complete documentation index, see llms.txt. This page is also available as Markdown.

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 music

Notes:

  • .{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

Supported format:

  • Netscape HTTP Cookie File (ONLY format accepted)

  • Single-domain only - cookies must be for one domain and its subdomains

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:

Via API

Response Examples

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

  1. Cookie Upload: User uploads cookie via /api/fileupload or /cookie interface

  2. Domain Detection: System extracts primary domain (e.g., youtube.com, leboncoin.fr)

  3. File Storage: Cookie saved as .DOMAIN.cookie in user's MULTIPASS directory with permissions 600

  4. Daily Scan: During MULTIPASS refresh (NOSTRCARD.refresh.sh), system scans for all .*.cookie files

  5. Scraper Lookup: For each cookie, system looks for DOMAIN.sh script in Astroport.ONE/IA/

  6. Execution: If found, script runs with user's email and cookie file path as arguments (once per day)

  7. 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 scraper

    • leboncoin.fr.sh → Leboncoin scraper

    • twitter.com.sh → Twitter scraper (etc...)

Python Backend (optional):

  • Format: scraper_DOMAIN.py

  • Location: 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_notified file)

  • 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 .done file: ~/.zen/tmp/${DOMAIN}_sync_${PLAYER}_${TODATE}.done

  • If .done file exists for today, scraper is skipped

  • Logs 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:

Supported Services

Service
Cookie File
Bash Script
Python Backend

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.sh script to Astroport.ONE/IA/ directory

  • System automatically detects and executes it

  • No code changes required in main system

  • See DOMAIN_SCRAPERS.md for 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:

  1. Upload the cookie file for ONE domain only (via /api/fileupload)

  2. System auto-detects the domain (e.g., amazon.fr → .amazon.fr.cookie)

  3. Use in your scripts:

Best Practices

How to Export Single-Domain Cookies

When using "Get cookies.txt LOCALLY" extension:

  1. Open the website you want to export cookies for

  2. Click the extension icon

  3. Filter by current site (usually done automatically)

  4. Select Netscape format

  5. Export - this creates a single-domain cookie file

  6. Upload to UPlanet

Important: Export cookies separately for each domain you want to use. Don't export all browser cookies at once.

API Endpoints

  • Endpoint: POST /api/fileupload

  • Auth: 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

Script
Purpose

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

Most cookies have expiration dates. If services fail with auth errors:

  1. Export fresh cookies from your browser

  2. Re-upload via /api/fileupload

  3. System 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:

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



Documentation: UPassport Cookie System v1.0 Last Updated: Décembre 2025 Maintainer: Astroport.ONE Team



Documentation: UPassport Cookie System v1.0 Last Updated: Décembre 2025 Maintainer: Astroport.ONE Team

Last updated