This is just a little 30-minute project I made for my own use, but figured I’d share. It simply takes a YouTube URL and converts it to GitHub-friendly Markdown for use in READMEs, wikis, and PR comments.

GitHub doesn’t allow for <iframe>s, so you can’t actually embed a YouTube video in a README. You can, however, easily embed a thumbnail and link it to the video. This little API does just that. Sure, it’s built with GitHub in mind, but it’s useful in any situation where you can’t use an actual embed but want to include a YouTube video.

You can play around with the API at https://brettterpstra.com/yt-md, which has full documentation and live testing.

The endpoint for the API is:

https://brettterpstra.com/yt-md/api

Include a ?url= (full YouTube URL) or ?id= (just a video ID) parameter, and it will generate the Markdown for you. You can also include &output=json or &output=html to get JSON or HTML output. Add &caption=0 to avoid including a caption in the HTML.

🔒

Premium Content

Bonus CLI and Shortcut