0

I made an app to download YouTube videos using pafy, and it works fine. Here is a code snippet:

    # Display video's thumbnail
    thumbnail = Image.open(requests.get(self.video.thumb, stream=True).raw)
    video_thumbnail = QImage(ImageQt(thumbnail))
    self.lblThumbnail.setPixmap(QPixmap.fromImage(video_thumbnail))

But, when I used pytube, it didn't work. Here is a code snippet:

    # Display video's thumbnail
    thumbnail = Image.open(requests.get(self.video.thumbnail_url, stream=True).raw)
    video_thumbnail = QImage(ImageQt(thumbnail))
    self.lblThumbnail.setPixmap(QPixmap.fromImage(video_thumbnail))

Nothing different except thumbnail_url, both thumbnail_url and thumb are strings.

The apps freezes, then crashes without displaying any error in the terminal. Any suggestions are welcomed

Thank you

1 Answers1

0

Finally, I found a solution, sorry for inconvenience I didn't search YouTube Here is a great simple solution

https://www.youtube.com/watch?v=ynW_vIPVNbc

Thanks