Capability first · transport second

YouTubeMedia.js

Parses YouTube video/playlist locators and constructs ordinary embed URLs with opt-in privacy enhancement.

SDK 0.5.18Runtime 0.8.12Protocol arcane/1
On this page

Overview

Parses YouTube video/playlist locators and constructs ordinary embed URLs with opt-in privacy enhancement.

  • Artifact
    YouTubeMedia.js · esm
  • Classification
    public first party
  • Availability
    Cross-host
  • Normalization
    Fully normalized.

Import and lifecycle

JavaScript
import * as module from '/arcane/modules/YouTubeMedia.js';

Pure URL parsing and construction; does not fetch, navigate, embed, or contact YouTube.

Application-facing behavior: parseYouTubeMedia(), youtubeEmbedUrl().

Protocol and host implementation

URL construction only This detail does not widen the application-facing API or grant authority.

Exports, signatures, parameters, and results

BindingFormDeclaration or signatureParameter syntax
parseYouTubeMediafunctionfunction parseYouTubeMedia(value)value
youtubeEmbedUrlfunctionfunction youtubeEmbedUrl(locator,{privacyEnhanced=false}={})locator,{privacyEnhanced=false}={}
CallableKindExact public signatureParameter syntax
parseYouTubeMediaexported-functionfunction parseYouTubeMedia(value)value
youtubeEmbedUrlexported-functionfunction youtubeEmbedUrl(locator,{privacyEnhanced=false}={})locator,{privacyEnhanced=false}={}

Parameter meanings and results

parseYouTubeMedia(value) returns mutable {type:'video',id,playlist?} or {type:'playlist',id}; current behavior accepts a bare video id or supported YouTube watch/embed/shorts/list URL locator. youtubeEmbedUrl(locator,{privacyEnhanced=false}) returns a regular YouTube embed URL by default; privacyEnhanced:true explicitly selects youtube-nocookie.

Events, side effects, and errors

Source-literal CustomEvent dispatches

No source-literal CustomEvent dispatch is part of this artifact.

Lifecycle and event flow

This artifact has no additional documented lifecycle event flow.

Direct coded failures

This artifact directly assigns no stable coded failure.

Exported Error subclasses

This artifact exports no Error subclass.

Documented failure behavior

  • TypeError for blank, invalid, unsupported-host, or id-less input.

Availability and capabilities

Cross-host. Fully normalized.

None; a later iframe or navigation owns external network/media policy.

Contract example

JavaScript
import {parseYouTubeMedia,youtubeEmbedUrl} from '/arcane/modules/YouTubeMedia.js';

const media = parseYouTubeMedia('https://youtu.be/dQw4w9WgXcQ');
console.log(youtubeEmbedUrl(media));

No direct Core call is claimed for this artifact. Any injected provider or consuming module retains its own documented authority.