When you are trying to one-box a youtube URL, Youtube automatically redirects to a page named consent.youtube.com. This page doesn’t have an oEmbed/OpenGraph tag, so oneboxing is unfortunately failing.
This is definitely not Discourse’s flaw, but has to do with a (as it seems) breaking change on Youtube’s end. I suspect this happens due to some new Europe regulation, because I can’t reproduce on meta.
Our server is in Europe (Germany) and you can see the redirecting URL here.
I logged on here last night to report this exact issue as it’s been happening to us recently too, but when I pasted my example YouTube URL, it worked fine here on meta
The issue is related to the “Data Consent Form” and OneBox catches that instead of the actual content.
If instead of using the https://youtube.com/watch?v=XYZ you change it to https://youtu.be/XYZ it works because that’s the “Share URL” and that doesn’t pop the Consent Dialog. (However, this is not ideal).
Unless Discourse/OneBox “autochanges” the URL to the “Short Version” when oneboxing, maybe, as a quick fix? IDK, just giving more info/feedback.
As a media-heavy community we have thousands and thousands of YouTube videos shared by our members with several hundred being posted per month.
This change by YouTube is proving to be a real problem already but I don’t think it’s something that can be solved by Discourse if YouTube themselves are forcing a redirect to their consent page?
So if discourse were to rewrite the url as you describe when the post was cooked that would fix it?
If that’s the case a plugin could fix it (maybe even a theme component?) , and I would guess that it would be PR welcome and/or that they’ll fix it pretty quick.
Just find it very “funny” because both: https://youtu.be/VIDEO and deleting “www” on the normal url, so: https://youtube.com/watch?v=VIDEO work. So the criteria for “blocking” with the consent popup is not very “logical” from a user’s perspective.
Is it possible for you to test those URLs again? This is what I’m currently seeing from a server in Frankfurt (wget output edited to just show the redirects):