Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

maxresdefault thumbnail #373

Closed
vieditcom opened this issue Jan 6, 2020 · 3 comments
Closed

maxresdefault thumbnail #373

vieditcom opened this issue Jan 6, 2020 · 3 comments

Comments

@vieditcom
Copy link

Method: video.thumbnail_url
Method returns:
(String) — if size is default, the URL of a 120x90px image.
(String) — if size is medium, the URL of a 320x180px image.
(String) — if size is high, the URL of a 480x360px image.
(nil) — if the size is not default, medium or high.
How we can get maxresdefault thumbnail (from "https://img.youtube.com/vi/#{video_id}/maxresdefault.jpg") ?

@kangkyu
Copy link
Contributor

kangkyu commented Jan 8, 2020

Is there an example video id, if it is okay? I think only some videos have that size thumbnail.

@vieditcom
Copy link
Author

Is there an example video id, if it is okay? I think only some videos have that size thumbnail.

I am fetching youtube "mqdefault" thumbnails to show previews of user's videos here: https://www.viedit.com/movies
I tried to fetch maxres thumbs and looks like ~70% has such resolution.
Info from one random movie for example:
https://www.viedit.com/movies/pizza-making-footage

"thumbnails": {
     "default": {
      "url": "https://i.ytimg.com/vi/QwMuzQk-JTs/default.jpg",
      "width": 120,
      "height": 90
     },
     "medium": {
      "url": "https://i.ytimg.com/vi/QwMuzQk-JTs/mqdefault.jpg",
      "width": 320,
      "height": 180
     },
     "high": {
      "url": "https://i.ytimg.com/vi/QwMuzQk-JTs/hqdefault.jpg",
      "width": 480,
      "height": 360
     },
     "standard": {
      "url": "https://i.ytimg.com/vi/QwMuzQk-JTs/sddefault.jpg",
      "width": 640,
      "height": 480
     },
     "maxres": {
      "url": "https://i.ytimg.com/vi/QwMuzQk-JTs/maxresdefault.jpg",
      "width": 1280,
      "height": 720
     }
    }

The reasons why this resolution is important:

  • it is the best quality thumbnail
  • there is no awful black borders (unlike sddefault and hqdefault)

@kangkyu
Copy link
Contributor

kangkyu commented Jan 21, 2020

Looks like it's working with maxres

> Yt::Video.new(id: "QwMuzQk-JTs").thumbnail_url(:maxres)
"https://i.ytimg.com/vi/QwMuzQk-JTs/maxresdefault.jpg"

@kangkyu kangkyu closed this as completed Jan 21, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants