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

How to get thumbnail url? #150

Closed
ghost opened this issue Sep 17, 2017 · 10 comments
Closed

How to get thumbnail url? #150

ghost opened this issue Sep 17, 2017 · 10 comments

Comments

@ghost
Copy link

ghost commented Sep 17, 2017

I am having problem to get thumbnail url. Is there any getter that returns thumbnail url.

@nficano
Copy link
Collaborator

nficano commented Oct 13, 2017

This is very simple in the latest release:

YouTube('https://youtu.be/9bZkp7q19f0').thumbnail_url

@nficano nficano closed this as completed Oct 13, 2017
@ejoo
Copy link

ejoo commented Oct 13, 2017

Thank You So much

@JuliB15
Copy link

JuliB15 commented Mar 31, 2018

The thumbnails have poor quality, is it possible to get a url to a higher resolution of them?

@francesc-h
Copy link

Would it be possible to add a new getter to retrieve the thumbnails available in player_config_args['player_response']['videoDetails']['thumbnail']['thumbnails'] ?

The thumbnails available there offer higher resolution and thus, are more sutiable to be used as cover art than the actual thumbnails that YouTube('https://youtu.be/9bZkp7q19f0').thumbnail_url return (default.jpg thumbnails are 120×90).

A non breaking-change solution might be to add another property like:

@property
def example(self):
    details = self.player_config_args['player_response']['videoDetails']
        
    thumbnails = [thumb['url'] for thumb in details['thumbnail']['thumbnails']]      
    return thumbnails

This new property would return a list with four thumbnail urls. The list is ordered in a way that the first thumbnail has the lowest resolution(168×94) and the last one offers the highest(336×188).

Another solution would involve rewriting the thumbnail_url property to return both the default thumbnail and the new ones. This might be possible following the list approach -ordering the urls by resolution- or by returning a dictionary.

If anyone finds this idea desirable I could create a pull request.

@solsticemoscow
Copy link

How add thumbnails in downloaded file?

@niyeradori
Copy link

Is it possible to get back a png file instead of a jpg?

@TipizYT
Copy link

TipizYT commented Oct 30, 2021

Is there a method that i can display an image in tkinter with the image url?

@vmay23
Copy link

vmay23 commented Feb 8, 2022

I'm also looking for it!

@Pratap99376
Copy link

I got it. Listen carefully default image that pytube generates is this "https://i.ytimg.com/vi/AjucWaIZ_Zk/sddefault.jpg". Now your only work is to change that sddefault.jpg to maxresdefault.jpg ok if u still have any problem then my whatsapp number +919937660423

@bitan005
Copy link

Is there a method that i can display an image in tkinter with the image @vmay23

Its possible... But at first you need to download the image since tkinter probably does not support displaying images from links.

import requests, shutil
from PIL import ImageTk, Image

root = Tk()

r = requests.get('your-link-here', stream=True)
if r.status_code == 200:
    with open("img.png", 'wb') as f:
        r.raw.decode_content = True
        shutil.copyfileobj(r.raw, f)

img = ImageTk.PhotoImage(Image.open("img.png"))
label = Label(root, image = img)
label.pack()

root.mainloop()

I also looked it up somewhere online... Hope it helps!

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

No branches or pull requests

10 participants