Bad inline onebox title for Spotify album shares

The title for an inline onebox is bad (not that I’m saying it’s our fault):

Inline: Spotify

source:

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

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

image (preview):

image (baked):

4 Likes

Do we need to update the browser version in the user agent our crawler is using? looks like we’re using Safari 14?

Visiting the URL manually in that Safari version:

We’re not consistent with user agents.

For the full onebox we use:

Discourse Forum Onebox v3.5.0.beta9-dev

and Spotify is fine with this and serves the full page:

○ → 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">

but for the inline onebox we use:

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

So that’s ultimately why we’re getting different behaviour, though I would still ask why we don’t use the opengraph properties here? Spotify is still serving those up despite being an unsupported browser:

○ → 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">
all properties
○ → 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 Likes

Hmmm:

Because <title> takes precedence over open graph in our implementation and we don’t want to hardcode the string “Unsupported browser”…

FIX: update final destination to use more recent user agent by SamSaffron · Pull Request #34207 · discourse/discourse · GitHub should fix this…

This feels way old though:

DEFAULT_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"

hmmm… now spotify give us the title “spotify” :slight_smile: we are going to need custom “spotify” code :frowning: if we want to get the album name.

2 Likes