~/tutorials/50-how-get-youtube-video-thumbnail-images.md

How to get Youtube Video Thumbnail Images

1 min readMarch 04, 2018by Gorav Singal#youtube-thumbnail#youtube-video-thumbnail#youtube-api
// TL;DR

YouTube exposes public thumbnail URLs at img.youtube.com/vi/{VIDEO_ID}/ in various resolutions (default, medium, high, standard, maxres) that anyone can use.

How to get Youtube Video Thumbnail Images

Problem

You know your youtube URL. And, you want to know its thumbnail image that you can use on your website, or somewhere. Note: Video can be any video on youtube.com website.

Get Youtube Thumbnail Images

Youtube provides video's thumbnails publically available to users. Anyone can use them. Youtube provides multiple resolution images. You need to know the video id.

If your youtube video looks like:https://www.youtube.com/watch?v=g0kFl7sBdDQ

Then, your video id is:g0kFl7sBdDQ

There are two ways to get thumbnail URL:

  1. Get URL from any of following possible URLs:
    1. https://i.ytimg.com/vi/<video_id>/default.jpg
      Having dimensions: 120x90
      This is the default image.
    2. https://i.ytimg.com/vi/<video_id>/mqdefault.jpg
      Having dimensions: 320x180
      This is called medium size thumbnail.
    3. https://i.ytimg.com/vi/<video_id>/hqdefault.jpg
      Having dimensions: 480x360
      This is called high size thumbnail.
    4. https://i.ytimg.com/vi/<video_id>/sddefault.jpg
      Having dimensions: 640x480
      This is called standard size.
    5. https://i.ytimg.com/vi/<video_id>/maxresdefault.jpg
      Having dimensions: 1280x720
      This is the maximum resolution available
  2. Use Youtube Rest APIs
    See: Using Youtube Rest APIs

Enjoy.

$ subscribe --weekly

One deep dive a week, in your inbox

System design, AI engineering, trading systems and interview prep. Tested code, real numbers. Free, and you can unsubscribe any time.

or read it on gyanbyte.substack.com

Share

Related Posts

Drupal Helpful codes for database queries

Drupal Helpful codes for database queries

Being a drupal user from last around 5 years, I used to know small codes for…

Curl - Your friend for Rest APIs/Calls - Basic Commands

Curl - Your friend for Rest APIs/Calls - Basic Commands

Curl is a wonderful tool for initiate REST APIs or calls. Or, you can literally…

Docker image for Drupal 7, and Php extension MongoDB installed.

Docker image for Drupal 7, and Php extension MongoDB installed.

You have drupal 7 image from docker hub, and want to connect tomongo db via php…

Docker Push&#58; How to push your docker image to your organization in hub.docker.com

Docker Push&#58; How to push your docker image to your organization in hub.docker.com

Tag the image, by seeing its image id, from docker images command docker tag 04d…

Youtube API in NodeJs, Usage with Example

Youtube API in NodeJs, Usage with Example

This library is ES6, promise compatible. Or, in your package.json file, include…

Jira Rest APIs common usages

Jira Rest APIs common usages

This article shows some of common usages of JIRA rest apis. Note: This article…

Latest Posts

How to Stay Valuable as a Software Engineer in the AI Era: A Practical Playbook

How to Stay Valuable as a Software Engineer in the AI Era: A Practical Playbook

In the previous article I argued that AI is not killing software engineering…

How to Review AI-Generated Code: A Checklist for Catching What the Model Missed

How to Review AI-Generated Code: A Checklist for Catching What the Model Missed

A few months back I approved a PR that was almost entirely AI-generated. It…

How to Debug AI-Generated Code: Understand First, Fix Last

How to Debug AI-Generated Code: Understand First, Fix Last

In the last article I wrote about reviewing AI code before it goes in. This one…

The Future of Software Engineering: What AI Changes, What Stays, and Where the Jobs Go

The Future of Software Engineering: What AI Changes, What Stays, and Where the Jobs Go

Every few weeks somebody sends me a scary headline — “AI will replace all…

The Transactional Outbox Pattern: Never Lose an Event Again

The Transactional Outbox Pattern: Never Lose an Event Again

This is one of those patterns that looks like nothing until you get burnt once…

Event Sourcing, Explained: Store What Happened, Not Just the Final State

Event Sourcing, Explained: Store What Happened, Not Just the Final State

Here is a question I like to ask in interviews: your bank account shows a…