stackernews / stacker.news

Internet communities that pay you Bitcoin
https://stacker.news
MIT License
403 stars 105 forks source link

Embed youtube shorts #1225

Closed ekzyis closed 3 weeks ago

ekzyis commented 3 weeks ago

Description

This is a small and simple change to embed YT shorts.

I actually wanted to embed YT clips like this but I haven't found a simple way. The embed URL requires the video id which is not available if given only the clip URL. I found this working embed URL in the document head:

<meta property="og:video:url" content="https://www.youtube.com/embed/2LKwnQJXngU?clip=Ugkx1bqCjGlspRX3VC5hWobnDQDIPdbPYu6b&amp;clipt=EM2f-AEYpcf6AQ">

Interestingly, YT does not seem to expose this embed URL when clicking on Share > Embed but uses this as the iframe src.

Fetching the document in the browser does not work ~due to CORS policy~ 403 errors.

Checklist

Are your changes backwards compatible? Please answer below:

yes

Did you QA this? Could we deploy this straight to production? Please answer below:

yes, tested with https://youtube.com/shorts/BcezUqtzPd8

For frontend changes: Tested on mobile? Please answer below:

Did you introduce any new environment variables? If so, call them out explicitly here: