Lazy video Onebox not loaded correctly for some YouTube videos

Recently my users have reported a problem with YouTube video embeds. Some of the YouTube links just work as before, some get partially embedded, some embeds are fully broken.

Example:
(Fully working)

(Has picture - no title)

(no picture, no title)

It seems that YouTube embed link https://www.youtube.com/embed/{video_id} is not working for the videos with partial oneboxes.

4 Likes

For me the common thread has been ‘Shorts’ which seem to break like this regularly.

I wonder if it’s related to the thumbnail on YouTubes side being generated after a significant delay?

Seems to often resolve with a rebuild of the Post, but would agree it would be nice if it didn’t happen in the first place.

2 Likes

If I’m reading this right system will get thumbnail from this url discourse/lib/onebox/engine/youtube_onebox.rb at main · discourse/discourse · GitHub

I did check it out manually and thumbnails are sometimes loaded a bit slower, but nothing that bad. For now as well I see consistent results. If onebox does not work for a video, it newer works.

As far as I have tested post rebuild produces the same result each time. I might add that meta.discourse.org behaves in the exactly the same way as my Discourse installation.

1 Like

On the video you shared, the critical url is the meta tag og:image which is:


https://i.ytimg.com/vi/XdU2mwcUzcg/hqdefault.jpg

which seems valid

So yes, this does look like a problem with OneBox?

2 Likes

+1 for this issue.

My installation is experiencing all the different behaviours for YT oneboxing as described above.

First reported incident was 26th July 2024 by my users

Just updated discourse and docker and it all seems fixed now. Because of course it does after you +1 a bug!

Not sure if this is the same bug
Embedding https://www.youtube.com/watch?v=RCSQlmUnMFs

Gives a really weird composer preview

1 Like

Just letting you know, we are tracking this and will see if we can get it sorted in the next 4 weeks or so.

If a community member figures out what is off pr-welcome

5 Likes