Class Test


In [25]:
%qtconsole

In [19]:
import sys
sys.version


Out[19]:
'3.3.3 (default, Nov 23 2013, 16:24:30) \n[GCC 4.2.1 (Apple Inc. build 5666) (dot 3)]'

In [20]:
from IPython.display import YouTubeVideo

In [1]:
#YoukuVideo class:
from IPython.display import IFrame
class YoukuVideo(IFrame):
    """ Just as youtube, write a youku video class
    e.g. to embed the video on this page:
    http://v.youku.com/v_show/id_foo.html
    
    vid = YoukuVideo("foo")
    display(vid)
    """
    
    def __init__(self, id, width=400, height=300, **kwargs):
        src = "http://player.youku.com/embed/{0}".format(id)
        super(YoukuVideo, self).__init__(src, width, height, **kwargs)

In [34]:
#大师生日视频
YoukuVideo('XNjQzNzU4NDQ4')


Out[34]:

In [27]:
#Test Youtube
#谁说女子不如男
YouTubeVideo('wAdTee75pME')


Out[27]:

In [3]:
YoukuVideo('XNjQ0NDY4MzI0')


Out[3]:

In [48]:
#YoukuVideoSecond class:
from IPython.display import IFrame
class YoukuVideoSecond(IFrame):
    """ Just as youtube, write a youku video class
    e.g. to embed the video on this page:
    http://v.youku.com/v_show/id_foo.html
    
    vid = YoukuVideo("foo")
    display(vid)
    """
    
    def __init__(self, id, width=400, height=300, **kwargs):
        src = "http://player.youku.com/embed/{0}".format(id)
        super(YoukuVideoSecond, self).__init__(src, width, height, **kwargs)

In [58]:
YoukuVideoSecond('XNjQzNzU4NDQ4',name="大师生日",align="middle")


Out[58]:

In [44]:
T = True

In [ ]: