fix(dailymotion): Player ID obligatoire dans l'URL d'embed
CI / build-and-test (push) Successful in 14m58s

Dailymotion exige désormais un Player ID (fév. 2026) : player.html?video=...
sans Player ID répond HTTP 403 'Forbidden'. L'URL correcte est
geo.dailymotion.com/player/{PLAYER_ID}.html?video=...

- helper dailymotionPlayerId()/dailymotionEmbedBase() (config window.DAILYMOTION_PLAYER_ID, repli demo x8lr5)
- /watch et /shorts utilisent le nouvel endpoint avec Player ID
- config.local.example.js documente la config
This commit is contained in:
2026-09-30 21:48:06 -04:00
parent c391be80e5
commit 2bcc7321aa
4 changed files with 49 additions and 15 deletions
@@ -0,0 +1,33 @@
/**
* Dailymotion : Player ID obligatoire (fév. 2026).
*
* Dailymotion a rendu le Player ID obligatoire sur le nouvel endpoint
* d'embed : `https://geo.dailymotion.com/player.html?video=…` SANS Player ID
* répond désormais HTTP 403 « Forbidden ». L'URL correcte est
* `https://geo.dailymotion.com/player/{PLAYER_ID}.html?video=…`.
*
* Configurable via `window.DAILYMOTION_PLAYER_ID` (assets/config.local.js).
* Repli sur un Player ID de démonstration public (`x8lr5`, fourni par la
* documentation Dailymotion) pour que l'embed fonctionne sans configuration.
* En production, créez votre propre Player (Dailymotion Studio → Players) et
* renseignez son ID — idéalement un player vertical (aspect_ratio 9:16) pour
* les Shorts.
*/
const DM_PLAYER_ID_DEFAULT = 'x8lr5';
/** Player ID Dailymotion effectif (config explicite sinon démonstration). */
export function dailymotionPlayerId(): string {
try {
const g = globalThis as any;
const raw = g?.DAILYMOTION_PLAYER_ID;
const v = typeof raw === 'string' ? raw.trim() : '';
if (v) return v;
} catch {}
return DM_PLAYER_ID_DEFAULT;
}
/** Base de l'URL d'embed Dailymotion (nouveau endpoint + Player ID). */
export function dailymotionEmbedBase(videoId: string): string {
return `https://geo.dailymotion.com/player/${encodeURIComponent(dailymotionPlayerId())}.html?video=${encodeURIComponent(videoId)}`;
}