Show More
@@ -263,8 +263,14 b' class YouTubeVideo(IFrame):' | |||||
263 | super(YouTubeVideo, self).__init__(src, width, height, **kwargs) |
|
263 | super(YouTubeVideo, self).__init__(src, width, height, **kwargs) | |
264 |
|
264 | |||
265 | def _repr_jpeg_(self): |
|
265 | def _repr_jpeg_(self): | |
266 | from urllib import urlopen |
|
266 | try: | |
267 | return urlopen("https://img.youtube.com/vi/{id}/hqdefault.jpg".format(id=self.id)).read() |
|
267 | from urllib.request import urlopen # Py3 | |
|
268 | except ImportError: | |||
|
269 | from urllib2 import urlopen | |||
|
270 | try: | |||
|
271 | return urlopen("https://img.youtube.com/vi/{id}/hqdefault.jpg".format(id=self.id)).read() | |||
|
272 | except IOError: | |||
|
273 | return None | |||
268 |
|
274 | |||
269 | class VimeoVideo(IFrame): |
|
275 | class VimeoVideo(IFrame): | |
270 | """ |
|
276 | """ |
General Comments 0
You need to be logged in to leave comments.
Login now