Skip to content

Instantly share code, notes, and snippets.

@bassamanator
Forked from bitsurgeon/youtube.md
Created December 19, 2023 06:13
Show Gist options
  • Save bassamanator/b352038498efd37b46b7371d5635f50e to your computer and use it in GitHub Desktop.
Save bassamanator/b352038498efd37b46b7371d5635f50e to your computer and use it in GitHub Desktop.
Markdown cheatsheet for YouTube

Embed YouTube Video in Markdown File

  1. Markdown style
[![Watch the video](https://img.youtube.com/vi/nTQUwghvy5Q/default.jpg)](https://youtu.be/nTQUwghvy5Q)
  1. HTML style
<a href="http://www.youtube.com/watch?feature=player_embedded&v=nTQUwghvy5Q" target="_blank">
 <img src="http://img.youtube.com/vi/nTQUwghvy5Q/mqdefault.jpg" alt="Watch the video" width="240" height="180" border="10" />
</a>
  1. embed thumbnail
![alt text][image]
[image]: /full/path/to/image/file.jpg "alt_txt"
  1. resize thumbnail
<img src="/full/path/to/image/file.jpg" alt="alt_text" width="200">

Extras on Thumbnail Format

Each YouTube video has 4 generated images. The first one in the list is a full size image and others are thumbnail images. They are predictably formatted as follows:

https://img.youtube.com/vi/<insert-youtube-video-id-here>/0.jpg
https://img.youtube.com/vi/<insert-youtube-video-id-here>/1.jpg
https://img.youtube.com/vi/<insert-youtube-video-id-here>/2.jpg
https://img.youtube.com/vi/<insert-youtube-video-id-here>/3.jpg

The default thumbnail image (ie. one of 1.jpg, 2.jpg, 3.jpg) is:

https://img.youtube.com/vi/<insert-youtube-video-id-here>/default.jpg  

Other than the default.jpg, the following thumbnail formats are also available:

  • hqdefault.jpg <- high quality
  • mqdefault.jpg <- medium quality
  • sddefault.jpg <- standard definition
  • maxresdefault.jpg <- maximum resolution

NB: sddefault.jpg and maxresdefault.jpg are not always available.

All of the above urls are available over http too. Additionally, the slightly shorter hostname i3.ytimg.com works in place of img.youtube.com in the example urls above.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment