##// END OF EJS Templates
ENH added _repr_jpeg_ method for YouTubeVideo object to allow conversion...
Ben Kasel -
Show More
@@ -255,8 +255,12 b' class YouTubeVideo(IFrame):'
255 """
255 """
256
256
257 def __init__(self, id, width=400, height=300, **kwargs):
257 def __init__(self, id, width=400, height=300, **kwargs):
258 self.id=id
258 src = "https://www.youtube.com/embed/{0}".format(id)
259 src = "https://www.youtube.com/embed/{0}".format(id)
259 super(YouTubeVideo, self).__init__(src, width, height, **kwargs)
260 super(YouTubeVideo, self).__init__(src, width, height, **kwargs)
261 def _repr_jpeg_(self):
262 from urllib import urlopen
263 return urlopen("https://img.youtube.com/vi/{id}/0.jpg".format(id=self.id)).read()
260
264
261 class VimeoVideo(IFrame):
265 class VimeoVideo(IFrame):
262 """
266 """
General Comments 0
You need to be logged in to leave comments. Login now