YouTube & Video Management System - Documentation
🎯 Overview
The UPlanet video management system provides three modes for creating and managing videos:
Manual Download (
#youtubetag) - On-demand YouTube video downloadsAutomatic Sync - Daily synchronization of liked videos via NOSTR refresh cycle
Webcam Recording (
/webcamroute) - Direct video recording and upload with geolocation
🔧 How It Works
Webcam Recording Process Flow (NEW)
User accesses
/webcamroute with NOSTR authenticationRecords video via browser webcam or uploads local video file (.mp4, .webm, .mov)
Geolocation capture - User can specify coordinates or use current location (defaults to 0.00, 0.00)
IPFS Upload - Video uploaded via
/api/fileuploadendpointNOSTR Publication - NIP-71 event (kind 21/22) with geographic tags:
gtag: Geohash format (lat,lon) for UMAP anchoringlocationtag: Human-readable coordinateslatitudeandlongitudetags: Individual coordinate tags
uDRIVE Storage - Video saved to
uDRIVE/Videos/directoryGeographic Discovery - Videos searchable by location via
/youtuberoute
Manual Download Process Flow
User sends message with
#youtubetag + YouTube URLUPlanet_IA_Responder.sh detects the tag and calls
process_youtube.shprocess_youtube.sh tries multiple cookie strategies:
User-uploaded cookies (
.cookie.txtfrom astro_base interface)Browser cookies (from Chrome, Firefox, Brave, Edge)
Generated cookies (basic fallback)
yt-dlp downloads the video/audio
IPFS uploads the media
NOSTR Events published (kind: 1 + NIP-71 kind: 21/22)
Response sent back to user with IPFS link
Automatic Sync Process Flow
NOSTRCARD.refresh.sh runs daily for each MULTIPASS user
Cookie Detection - Checks for
.cookie.txtin user's NOSTR directoryYouTube Sync Trigger - If cookies exist, launches
youtube.com.shLiked Videos Fetch - Retrieves up to 2 new liked videos from YouTube
Video Processing - Calls
process_youtube.shfor each videoNOSTR Publication - Publishes NIP-71 events for each downloaded video
uDRIVE Organization - Videos stored in
uDRIVE/Videos/anduDRIVE/Music/Email Notification - User receives sync summary via email
Cookie Strategies (Priority Order)
Channel Watch — Suivi automatique de chaînes (optionnel)
En plus des vidéos likées, le cycle quotidien peut surveiller des chaînes YouTube et copier leurs nouvelles vidéos. Créez le fichier de configuration (une URL de chaîne par ligne, # pour commenter) :
Fonctionnement (sync_youtube_channels dans youtube.com.sh, exécuté juste après la sync des likes) :
Interroge l'onglet public
/videosde chaque chaîne (pas besoin de cookie pour cette étape — la playlist est publique)Télécharge au maximum 1 nouvelle vidéo par chaîne et par jour (léger, adapté Raspberry Pi)
Réutilise le même pipeline que les likes : téléchargement
process_youtube.sh, upload/api/fileupload, publication NOSTR NIP-71 (kind 21/22), rangement dansuDRIVE/Videos/Dédoublonnage global par
video_iddans.processed_youtube_videos(une vidéo likée ET publiée par une chaîne suivie n'est copiée qu'une fois)Best-effort : un échec sur une chaîne n'interrompt ni les autres chaînes ni la synchronisation des likes
Les vidéos de plus de 90 minutes sont ignorées (même règle que les likes)
Sans fichier .youtube.com.channels, rien ne change : seule la sync des likes s'exécute.
📼 Mode 4 — Voeu TW CopierYoutube (chaîne complète, dans le TiddlyWiki)
Ce mode est le plus puissant : il permet d'archiver une chaîne YouTube entière (ou une playlist) en formulant un voeu directement dans le TiddlyWiki personnel. L'ASTROBOT traite le voeu à chaque cycle PLAYER.refresh.sh.
Principe
Créer le voeu dans le TW (un tiddler avec les tags
voeu+CopierYoutube)Créer un ou plusieurs tiddlers de contenu (tags :
CopierYoutube) contenant les URLs à archiverLe système détecte le voeu et appelle
ASTROBOT/Z/G1CopierYoutube.shautomatiquementChaque vidéo téléchargée devient un tiddler dans le TW avec lecteur vidéo/audio embarqué
Étapes dans le TiddlyWiki
Étape 1 — Formuler le voeu
Créer un tiddler avec :
Étape 2 — Lister les URLs à archiver
Créer un tiddler par source avec :
Pour une playlist :
Pour plusieurs sources, mettre une URL par ligne dans le texte, ou créer plusieurs tiddlers tagués CopierYoutube.
Étape 3 — Pour archiver en audio seulement (MP3)
Ajouter le tag MP3 au tiddler de contenu :
Ce que fait l'ASTROBOT
Les vidéos apparaissent dans le TW sous le tag CopierYoutube avec lecteur intégré. Elles sont simultanément :
publiées comme événements NIP-71 (kind 21/22) visibles sur
/youtubesauvegardées dans le uDRIVE du joueur (
Videos/ouMusic/pour MP3)indexées comme fichiers NIP-94 (kind 1063) dans la constellation
Cookies YouTube
Le script utilise les cookies du navigateur par défaut (détection automatique). Pour les stations sans interface graphique (serveur), uploader les cookies via :
Suivi des archives
Déclenchement manuel
Extension IA — MineLife et Grimoire
Vision (non implémentée, RFC) : relier le contenu archivé à la toile de compétences WoTx2.
Le titre du voeu (CopierYoutube) peut porter le nom d'une compétence cible. Après le téléchargement, un script d'analyse IA pourrait :
Analyser la vidéo — Ollama (
question.py) pour transcrire ou décrire le contenuExtraire les concepts liés à la compétence du voeu
Publier kind 30504 (knowledge content) avec la vidéo comme source
Alimenter MineLife — la compétence devient cherchable dans le catalogue Qdrant
Déclencher Grimoire — après validation WoTx2 (craft success), générer un kind 22 vidéo résumé
→ Voir MINELIFE.md, GRIMOIRE_LIVE.md
🍪 Cookie Management
Why Cookies Are Needed
YouTube blocks bot requests. Fresh browser cookies allow ASTROBOT to download videos as if a real user is accessing them.
How to Upload Cookies
Export cookies from your browser using the guide:
Upload the file via the ASTROBOT interface:
System automatically detects the Netscape format and saves to:
Automatic Sync Activation
Once you upload cookies, the system automatically:
Detects your cookies during daily NOSTR refresh cycle
Launches YouTube sync for your liked videos
Downloads up to 3 new videos per day
Organizes videos in your uDRIVE
Publishes NOSTR events for each video
Sends email notifications with sync results
Cookie File Format
The system expects Netscape cookie format. Cookies are automatically detected and stored as .youtube.com.cookie in your MULTIPASS directory.
📖 For complete cookie management documentation, see COOKIE_SYSTEM.md
Example format:
Note: The system now uses domain-specific cookie files (.youtube.com.cookie) instead of the generic .cookie.txt format. Upload your cookies via the /cookie interface for automatic detection and storage.
📋 Logs and Debugging
Log File Location
All YouTube processing logs are written to:
Manual Log Commands
🐛 Common Issues
Issue 1: "YouTube authentication failed"
Cause: Cookies are missing, expired, or invalid.
Solution:
Export fresh cookies from your browser (see cookie guide)
Upload via astro_base interface
Try again
Issue 2: "Download or IPFS upload failed"
Causes:
YouTube bot detection
Network issues
IPFS daemon not running
Video too long (>3h limit)
Solution:
Check logs
Verify IPFS is running:
ipfs idTry with fresh cookies
Check video duration
Issue 3: Empty response (no Title, Duration, etc.)
Cause: All cookie strategies failed.
Debug:
Issue 4: HTTP 403 Forbidden / fragment not found (DASH)
Cause: YouTube requires a Proof of Origin (PO) token for some clients. See yt-dlp PO Token Guide.
Solutions (in order):
Update yt-dlp – Already done daily by
install_yt_dlp_ejs_node.sh.PO Token Provider plugin – Installed optionally by the same script. Run the provider:
docker run -d -p 4416:4416 --name bgutil-provider brainicism/bgutil-ytdlp-pot-providerManual PO token (GVS) – Put the token in one line (no spaces) in:
~/.zen/game/nostr/<your-email>/.youtube.potokenHow to get it: PO Token Guide – PO Token for GVS (YouTube Music → Network → v1/player →serviceIntegrityDimensions.poToken).
The scripts prefer clients that do not require a PO token (tv_embedded, tv) and retry with them on 403.
📊 Debug Mode
Debug mode is automatically enabled in UPlanet_IA_Responder.sh for all YouTube downloads.
To manually enable debug mode:
JSON Output Options:
For reliable JSON parsing (recommended), use --json-file:
Custom Output Directory:
🎬 NIP-71 Video Events
Event Types Published
The system publishes two types of NOSTR events for each video:
Kind 1 - Text message (compatibility with older clients)
Kind 21/22 - NIP-71 video events (modern standard)
NIP-71 Classification (implémentation réelle)
Kind 21 — long-form : durée > 60 secondes
Kind 22 — short-form : durée ≤ 60 secondes
NIP-71 Tags Structure
Tags générés par publish_nip71_video() dans G1CopierYoutube.sh :
Le tag thumb est une URL complète (format NIP-71 standard). gifanim_url est un tag custom Astroport pour la prévisualisation animée.
Pipeline complet par vidéo
yt-dlp → télécharge mp4/mp3 dans
~/.zen/tmp/yt-dlp/IPFS add → obtient le CID
ajouter_media.sh→ copie dansuDRIVE/Videos/+info.json+ NIP-94 kind 1063TW import → tiddler
<video>dans le wiki personnelNIP-71 kind 21/22 → événement vidéo NOSTR via clef MULTIPASS
Example NIP-71 Event
📺 Video Interfaces
YouTube Channel Interface (/youtube)
Access your videos and browse community content:
Features
Video Gallery - Browse all downloaded and recorded videos
NOSTR Integration - Like videos, view author profiles
Geographic Filtering - Search videos by location (lat, lon, radius)
Responsive Design - Works on PC and mobile
IPFS Streaming - Direct video playback from IPFS
Metadata Display - Duration, file size, dimensions, keywords, location
Channel Organization - Videos grouped by uploader/creator
Geographic Search
Filter videos by location using URL parameters:
Parameters:
lat: Latitude (decimal degrees)lon: Longitude (decimal degrees)radius: Search radius in kilometershtml=1: Return HTML view (required for web browser)
The system uses the Haversine formula to calculate geographic distances and filter videos within the specified radius.
Webcam Recording Interface (/webcam)
Record or upload videos with geolocation:
Features
NOSTR Authentication - Connect via browser extension or nsec key
Webcam Recording - Direct browser recording (3-60 seconds)
File Upload - Upload local video files (.mp4, .webm, .mov, max 500MB)
Geolocation - Interactive map for location selection
Preview & Edit - Review video before publishing
IPFS Upload - Automatic upload via
/api/fileuploadNIP-71 Publishing - Creates proper video events with geographic tags
uDRIVE Storage - Saves to personal
uDRIVE/Videos/directory
Recording Workflow
Connect NOSTR - Authenticate with your NOSTR identity
Choose Source:
Record via webcam (adjustable duration)
Upload video file from device
Preview - Review video in modal
Edit Metadata:
Title (required)
Description (optional)
Geographic location (interactive map or manual input)
Publish - Video uploaded to IPFS and published to NOSTR
View - Access via
/youtubeinterface with geographic filtering
🔗 Related Files
💡 Tips
Cookie lifespan: YouTube cookies typically last 1-3 months. Re-export when downloads start failing.
Multiple users: Each user can upload their own cookies. The system automatically uses cookies for the requesting user.
Privacy: Cookies are stored locally and only used for YouTube downloads. They're not shared or transmitted.
Format detection:
#youtubedefaults to MP4. Add#mp3for audio-only:#youtube #mp3Duration limit: Videos longer than 3 hours are rejected to prevent resource exhaustion.
Automatic sync: Upload cookies once and your liked videos will sync automatically every day (up to 2 new videos per day).
NIP-71 compatibility: All videos are published as fully compliant NIP-71 events with proper
imetatags,title,published_at,alt, and accessibility features.uDRIVE organization: Videos are automatically organized in your personal uDRIVE storage (
uDRIVE/Videos/anduDRIVE/Music/).Email notifications: You'll receive daily summaries of your YouTube sync results.
Channel interface: Access all your videos via the
/youtuberoute with full NOSTR integration and geographic filtering.Webcam recording: Record videos directly in browser with adjustable duration (3-60 seconds, optimized for mobile).
Video upload: Upload local video files (.mp4, .webm, .mov) up to 500MB via
/webcaminterface.Geolocation: Add location data to videos for geographic discovery and UMAP anchoring (defaults to 0.00, 0.00 if not specified).
Geographic search: Filter videos by location using
lat,lon, andradiusURL parameters on/youtuberoute.IPFS streaming: All videos accessible via IPFS gateway for decentralized, censorship-resistant playback.
🔄 System Architecture
Complete Video Management Flow
YouTube Download Flow
Webcam Recording Flow
Key Components
Cookie Upload:
cookie.html→astro_base.html→.cookie.txtDaily Sync:
NOSTRCARD.refresh.sh→youtube.com.sh→process_youtube.shWebcam Recording:
/webcam→ NOSTR auth → video capture →/api/fileuploadIPFS Upload:
/api/fileupload→uDRIVE/Videos/→ IPFS CIDNOSTR Publishing:
/webcamroute → NIP-71 event with geographic tagsVideo Processing:
process_youtube.sh→ IPFS → NOSTR → uDRIVEChannel Parsing:
create_video_channel.py→ Extract NIP-71 events with geolocationUser Interface:
/youtuberoute →youtube.htmlwith geographic filteringGeographic Discovery: Haversine formula → filter videos by lat/lon/radius
🆘 Support
If you encounter issues:
YouTube Download Issues
Check logs:
tail -f ~/.zen/tmp/IA.log | grep "process_youtube"Verify cookie file exists and is recent:
ls -la ~/.zen/game/nostr/*/. cookie.txtTest with a different YouTube URL
Update yt-dlp:
pip install --upgrade yt-dlp
Webcam Recording Issues
Verify NOSTR connection: Check browser console for connection errors
Check IPFS upload: Verify
/api/fileuploadendpoint is accessibleBrowser permissions: Ensure webcam/microphone access is granted
File size: Maximum 500MB for uploaded videos
Supported formats: .mp4, .webm, .mov
General System Checks
Check IPFS daemon:
ipfs idCheck NOSTR relay:
ws://127.0.0.1:7777orwss://relay.copylaradio.comVerify uDRIVE directory:
~/.zen/game/nostr/<email>/APP/uDRIVE/Videos/Check video storage:
ls -lh ~/.zen/game/nostr/<email>/APP/uDRIVE/Videos/
Geographic Filtering Issues
Verify coordinates format: Use decimal degrees (e.g., 48.86, not 48°51'N)
Check radius parameter: Value in kilometers (default: 10.0)
Test without filters: Access
/youtube?html=1firstBrowser console: Check for JavaScript errors in geographic calculations
For more help, contact: support@qo-op.com
Last updated