Mauvais titre onebox inline pour les partages d'albums Spotify

Le titre d’une onebox intégrée est mauvais (sans dire que c’est de notre faute) :

Intégré : Spotify

source :

https://open.spotify.com/album/1nrWysWdrgPR0kBJ45z2aS?si=FurcwGpfSrWJBPGwKeCvDQ

Intégré : https://open.spotify.com/album/1nrWysWdrgPR0kBJ45z2aS?si=FurcwGpfSrWJBPGwKeCvDQ

image (aperçu) :

image (cuite) :

4 « J'aime »

Devons-nous mettre à jour la version du navigateur dans l’agent utilisateur que notre crawler utilise ? Il semble que nous utilisions Safari 14 ?

Visite de l’URL manuellement dans cette version de Safari :

Nous ne sommes pas cohérents avec les agents utilisateurs.

Pour le onebox complet, nous utilisons :

Discourse Forum Onebox v3.5.0.beta9-dev

et Spotify est d’accord avec cela et sert la page complète :

○ → curl -s --user-agent 'Discourse Forum Onebox v3.5.0.beta9-dev' 'https://open.spotify.com/album/1nrWysWdrgPR0kBJ45z2aS?si=FurcwGpfSrWJBPGwKeCvDQ' | htmlq 'meta[property^="og:description"], meta[property^="og:site_name"], title'
<title>The First Symphony - Album by Indecent | Spotify</title>
<meta content="Spotify" property="og:site_name">
<meta content="Indecent · Album · 2024 · 12 songs" property="og:description">
<meta content="Spotify" property="og:site_name">

mais pour le onebox intégré, nous utilisons :

Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_7) AppleWebKit/605.1.15 (KHTML, like Gecko) Version/14.0 Safari/605.1.15

C’est donc finalement la raison pour laquelle nous obtenons un comportement différent, bien que je me demanderais toujours pourquoi nous n’utilisons pas les propriétés opengraph ici ? Spotify les propose toujours malgré le fait qu’il s’agisse d’un navigateur non pris en charge :

○ → curl -s --user-agent 'Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_7) AppleWebKit/605.1.15 (KHTML, like Gecko) Version/14.0 Safari/605.1.15' 'https://open.spotify.com/album/1nrWysWdrgPR0kBJ45z2aS?si=FurcwGpfSrWJBPGwKeCvDQ' | htmlq 'meta[property^="og:description"], meta[property^="og:site_name"], title'
<title>Unsupported browser</title>
<meta content="Spotify" property="og:site_name">
<meta content="Indecent · Album · 2024 · 12 songs" property="og:description">
<meta content="Spotify" property="og:site_name">
toutes les propriétés
○ → curl -s --user-agent 'Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_7) AppleWebKit/605.1.15 (KHTML, like Gecko) Version/14.0 Safari/605.1.15' 'https://open.spotify.com/album/1nrWysWdrgPR0kBJ45z2aS?si=FurcwGpfSrWJBPGwKeCvDQ' | htmlq 'meta[property^="og:"]'
<meta content="Spotify" property="og:site_name">
<meta content="The First Symphony" property="og:title">
<meta content="Indecent · Album · 2024 · 12 songs" property="og:description">
<meta content="https://open.spotify.com/album/1nrWysWdrgPR0kBJ45z2aS" property="og:url">
<meta content="music.album" property="og:type">
<meta content="Spotify" property="og:site_name">
<meta content="AR" property="og:restrictions:country:allowed">
…
<meta content="XK" property="og:restrictions:country:allowed">
<meta content="https://i.scdn.co/image/ab67616d0000b273ff9434b9650f38d183e91fb1" property="og:image">
2 « J'aime »

Hmmm :

Parce que \u003ctitle\u003e a la priorité sur open graph dans notre implémentation et que nous ne voulons pas coder en dur la chaîne « Navigateur non pris en charge »…

FIX: update final destination to use more recent user agent by SamSaffron · Pull Request #34207 · discourse/discourse · GitHub devrait résoudre ce problème…

Cela semble très ancien cependant :

DEFAULT_USER_AGENT =\n \"Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_7) AppleWebKit/605.1.15 (KHTML, like Gecko) Version/14.0 Safari/605.1.15\"

hmmm… maintenant spotify nous donne le titre “spotify” :slight_smile: nous allons avoir besoin de code personnalisé “spotify” :frowning: si nous voulons obtenir le nom de l’album.

2 « J'aime »