Files
devplacepy/devplacepy/static/js/embed-spec.js
T
retoorandClaude Sonnet 5.5 f705099928 Inline YouTube Music embeds with one shared embed spec
YouTube Music has no player of its own and music.youtube.com sends
X-Frame-Options SAMEORIGIN, so music links render YouTube's own player
with an Open in YouTube Music caption. Tracks, playlists and OLAK5uy
albums embed; browse, channel, search and library stay plain links.

- embeds.py is the single URL spec (exact host allowlists, query-order
  independent, validated ids only); embed-spec.js is generated from it by
  the embeds-sync CLI command and drift is tested
- rendering.py and ContentRenderer.js both follow it; the old duplicate
  YouTube regexes are removed
- max 3 music embeds per content item, overflow stays a plain link
- fixes evilyoutube.com matching and watch?feature=share&v=ID links
- fixes the invalid unicode CSS escape that printed u2197 after every
  external link in rendered content
- docs, privacy third-party row, parser table tests, server/client parity

Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
2026-11-01 11:53:55 +01:00

33 lines
853 B
JavaScript

// retoor <retoor@molodetz.nl>
export const EMBED_SPEC = {
"allow": "accelerometer; autoplay; clipboard-write; encrypted-media; gyroscope; picture-in-picture",
"embedBase": "https://www.youtube.com/embed",
"listIdPattern": "[A-Za-z0-9_-]{13,64}",
"maxMusicEmbeds": 3,
"maxStartSeconds": 86400,
"musicCaption": "Open in YouTube Music",
"musicHosts": [
"music.youtube.com"
],
"pathVideoPrefixes": [
"embed",
"v",
"shorts"
],
"playlistSlug": "videoseries",
"shortHosts": [
"www.youtu.be",
"youtu.be"
],
"startPattern": "[0-9]{1,6}s?",
"videoIdPattern": "[A-Za-z0-9_-]{11}",
"youtubeHosts": [
"m.youtube.com",
"www.youtube-nocookie.com",
"www.youtube.com",
"youtube-nocookie.com",
"youtube.com"
]
};