当前位置: 首页>>代码示例>>Python>>正文


Python YDStreamExtractor.getVideoInfo方法代码示例

本文整理汇总了Python中YDStreamExtractor.getVideoInfo方法的典型用法代码示例。如果您正苦于以下问题:Python YDStreamExtractor.getVideoInfo方法的具体用法?Python YDStreamExtractor.getVideoInfo怎么用?Python YDStreamExtractor.getVideoInfo使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在YDStreamExtractor的用法示例。


在下文中一共展示了YDStreamExtractor.getVideoInfo方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。

示例1: getExtURL

# 需要导入模块: import YDStreamExtractor [as 别名]
# 或者: from YDStreamExtractor import getVideoInfo [as 别名]
def getExtURL(urlPage):
  print 'YoutubeDL decoding ' + urlPage
  
  vid = YDStreamExtractor.getVideoInfo(urlPage,quality=2) #quality is 0=SD, 1=720p, 2=1080p and is a maximum
  stream_url = vid.streamURL() #This is what Kodi (XBMC) will play
  
  return stream_url
开发者ID:JUL1EN094,项目名称:JUL1EN094-xbmc-addons,代码行数:9,代码来源:utils.py

示例2: download_video

# 需要导入模块: import YDStreamExtractor [as 别名]
# 或者: from YDStreamExtractor import getVideoInfo [as 别名]
    def download_video(self):
        selection = xbmcgui.Dialog().select(heading=LANG(22080), list=[LANG(33003)])
        if selection == 0:
            import YDStreamExtractor

            vid = YDStreamExtractor.getVideoInfo(self.listitem.getProperty("youtube_id"), quality=1)
            YDStreamExtractor.handleDownload(vid)
开发者ID:teamThevibe,项目名称:script.extendedinfo,代码行数:9,代码来源:DialogBaseInfo.py

示例3: playYoutubeVid

# 需要导入模块: import YDStreamExtractor [as 别名]
# 或者: from YDStreamExtractor import getVideoInfo [as 别名]
def playYoutubeVid(id, meta=None, poster=None):
    '''
    from resources.lib import pafy
    pafy.set_api_key(vars.API_KEY)
    #Resolve the youtube video url for ourselves
    v = pafy.new(id)
    stream_url = v.getbest().url
    '''
    if meta is None:
        #Create an empty meta, so we can fill it with the information grabbed from youtube
        meta = {}
    if 'title' not in meta:
        meta['title'] = v.title #Store the youtube title in the meta  
    if poster is None:
        poster = 'Default.png'
    
    
    #YDStreamExtractor.disableDASHVideo(True) #Kodi (XBMC) only plays the video for DASH streams, so you don't want these normally. Of course these are the only 1080p streams on YouTube
    try:
        #url = id #a youtube ID will work as well and of course you could pass the url of another site
        vid = YDStreamExtractor.getVideoInfo(id,quality=1) #quality is 0=SD, 1=720p, 2=1080p and is a maximum
        stream_url = vid.streamURL() #This is what Kodi (XBMC) will play
    except:
        dev.log('Failed to get a valid stream_url!')
        return False #Failed to grab a video title
    
    
    #xbmc.Player().play(v.getbest().url) #Play this video
    liz = xbmcgui.ListItem(meta['title'], iconImage=poster, thumbnailImage=poster)
    liz.setInfo( type="Video", infoLabels=meta )
    liz.setPath(stream_url)
    return xbmcplugin.setResolvedUrl(int(sys.argv[1]), True, liz)
开发者ID:c0ns0le,项目名称:YCBuilds,代码行数:34,代码来源:play.py

示例4: playYoutubeVid

# 需要导入模块: import YDStreamExtractor [as 别名]
# 或者: from YDStreamExtractor import getVideoInfo [as 别名]
def playYoutubeVid(id, meta=None, poster=None):
    dev.log('poster: '+poster)
    #Poster URL that hickups the addon: image://C%3a%5cKodi%5cportable_data%5cuserdata%5caddon_data%5cplugin.video.youtubelibrary%5cStreams%5cTV%5cSleuteltje%20-%20Bios%20Intros%5cfolder.jpg/
    #poster = None
    if meta is None:
        #Create an empty meta, so we can fill it with the information grabbed from youtube
        meta = {}
    if poster is None:
        poster = 'Default.png'
    elif poster.startswith('image://'):
        poster = poster[8:-1]
        poster = urllib.unquote(urllib.unquote(poster))
        dev.log('poster cleaned: '+poster)
    
    
    #YDStreamExtractor.disableDASHVideo(True) #Kodi (XBMC) only plays the video for DASH streams, so you don't want these normally. Of course these are the only 1080p streams on YouTube
    
    try:
        #url = id #a youtube ID will work as well and of course you could pass the url of another site
        vid = YDStreamExtractor.getVideoInfo(id,quality=1) #quality is 0=SD, 1=720p, 2=1080p and is a maximum
        stream_url = vid.streamURL() #This is what Kodi (XBMC) will play
    except:
        dev.log('Failed to get a valid stream_url!')
        return False #Failed to grab a video title
    
    if 'title' not in meta:
        meta['title'] = vid.title #Store the youtube title in the meta  
    
    
    #xbmc.Player().play(v.getbest().url) #Play this video
    liz = xbmcgui.ListItem(meta['title'], iconImage=poster, thumbnailImage=poster)
    liz.setInfo( type="Video", infoLabels=meta )
    liz.setPath(stream_url)
    return xbmcplugin.setResolvedUrl(int(sys.argv[1]), True, liz)
开发者ID:Sleuteltje,项目名称:plugin.video.youtubelibrary,代码行数:36,代码来源:play.py

示例5: fullInfo

# 需要导入模块: import YDStreamExtractor [as 别名]
# 或者: from YDStreamExtractor import getVideoInfo [as 别名]
def fullInfo(videoId):
    fullUrl = "https://www.youtube.com/watch?v=" + videoId
    vid = YDStreamExtractor.getVideoInfo(fullUrl,quality=1)
    
    streamurl = vid.streamURL()
    title = vid.title
    description = vid.description
    thumb = vid.thumbnail    
    
            
    return streamurl, title, description, thumb








# def batchResolve(collection):
#     for video in collection.videoList:
#         thread = ResolveThread(video)
#         thread.start()
# 
# 
# import threading
# class ResolveThread(threading.Thread):
#     def __init__(self, video):
#         threading.Thread.__init__(self)
#         self.video = video
#         
#     def run(self):       
#         print 'starting thread'
#         vid = YDStreamExtractor.getVideoInfo(self.video.fullUrl(),quality=1)
#         print vid.streamURL()
开发者ID:tonymeds,项目名称:Collections,代码行数:37,代码来源:urlResolver.py

示例6: handlePush

# 需要导入模块: import YDStreamExtractor [as 别名]
# 或者: from YDStreamExtractor import getVideoInfo [as 别名]
def handlePush(data, from_gui=False):
    if not from_gui and checkForWindow():  # Do nothing if the window is open
        return False
    if data.get("type") == "link":
        url = data.get("url", "")
        if StreamExtractor.mightHaveVideo(url):
            vid = StreamExtractor.getVideoInfo(url)
            if vid:
                if vid.hasMultipleStreams():
                    vlist = []
                    for info in vid.streams():
                        vlist.append(info["title"] or "?")
                    idx = xbmcgui.Dialog().select(util.T(32091), vlist)
                    if idx < 0:
                        return
                    vid.selectStream(idx)
                util.LOG(vid.streamURL())  # TODO: REMOVE
                StreamUtils.play(vid.streamURL())
                return True
        if canPlayURL(url):
            handleURL(url)
            return True
        media = getURLMediaType(url)
        if media == "video" or media == "music":
            StreamUtils.play(url)
            return True
        elif media == "image":
            import gui

            gui.showImage(url)
            return True
    elif data.get("type") == "file":
        if data.get("file_type", "").startswith("image/"):
            import gui

            gui.showImage(data.get("file_url", ""))
            return True
        elif data.get("file_type", "").startswith("video/") or data.get("file_type", "").startswith("audio/"):
            StreamUtils.play(data.get("file_url", ""))
            return True
    elif data.get("type") == "note":
        import gui

        gui.showNote(data.get("body", ""))
        return True
    elif data.get("type") == "list":
        import gui

        gui.showList(data)
        return True
    elif data.get("type") == "address":
        import urllib

        xbmc.executebuiltin(
            "XBMC.RunScript(special://home/addons/service.pushbullet.com/lib/maps.py,service.pushbullet.com,%s,None,)"
            % urllib.quote(data.get("address", ""))
        )
        return True

    return False
开发者ID:ruuk,项目名称:service.pushbullet.com,代码行数:62,代码来源:pushhandler.py

示例7: showVideo

# 需要导入模块: import YDStreamExtractor [as 别名]
# 或者: from YDStreamExtractor import getVideoInfo [as 别名]
def showVideo(url):
    if url:
        import YDStreamExtractor
        YDStreamExtractor.disableDASHVideo(True)

        vid = YDStreamExtractor.getVideoInfo(url, quality=1)
        url = vid.streamURL()
    plugin.set_resolved_url({'path':url, 'info': {'type': 'Video'}})
开发者ID:ruuk,项目名称:plugin.video.geekandsundry,代码行数:10,代码来源:geekandsundry.py

示例8: PlayTrailer

# 需要导入模块: import YDStreamExtractor [as 别名]
# 或者: from YDStreamExtractor import getVideoInfo [as 别名]
def PlayTrailer(youtube_id):
    import YDStreamExtractor
    YDStreamExtractor.disableDASHVideo(True)
    vid = YDStreamExtractor.getVideoInfo(youtube_id, quality=1)
    if vid:
        stream_url = vid.streamURL()
        log("Youtube Trailer:" + stream_url)
        xbmc.executebuiltin("PlayMedia(%s)" % stream_url)
开发者ID:elnino90,项目名称:script.extendedinfo,代码行数:10,代码来源:Utils.py

示例9: get_video_info

# 需要导入模块: import YDStreamExtractor [as 别名]
# 或者: from YDStreamExtractor import getVideoInfo [as 别名]
def get_video_info(url):
    info = YDStreamExtractor.getVideoInfo(url)
    if hasattr(info, '_streams'):
        return info
    else:
        log_utils.log('Stream not available: |%s|' % url, log_utils.LOGERROR)
        kodi.notify(msg=kodi.i18n('stream_not_available'), sound=False)
        return None
开发者ID:anxdpanic,项目名称:context.youtube.download,代码行数:10,代码来源:utils.py

示例10: downloadYoutubeVid

# 需要导入模块: import YDStreamExtractor [as 别名]
# 或者: from YDStreamExtractor import getVideoInfo [as 别名]
def downloadYoutubeVid(name, fold, videoid, settings, type='', season=None):
    #youtube-dl command to download best quality: -f bestvideo[ext!=webm]‌​+bestaudio[ext!=webm]‌​/best[ext!=webm]
    #YDStreamExtractor.disableDASHVideo(True)
    
    movieLibrary = vars.tv_folder #The path we should save in is the vars.tv_folder setting from the addon settings
    if type=='musicvideo':
        movieLibrary = vars.musicvideo_folder
    if type=='movies':
        movieLibrary = vars.movies_folder
    
    folder = os.path.join(movieLibrary, fold) #Set the folder to the maindir/dir
    enc_name = dev.legal_filename(name) #Encode the filename to a legal filename
    
    xbmcvfs.mkdir(movieLibrary) #Create the maindirectory if it does not exist yet
    xbmcvfs.mkdir(folder) #Create this subfolder if it does not exist yet
    
    xbmcvfs.mkdir(folder) #Create this subfolder if it does not exist yet
    if type == '' or type == 'tv':
        folder = os.path.join(folder, 'Season '+season) #Set the folder to the maindir/dir
        xbmcvfs.mkdir(folder) #Create this subfolder if it does not exist yet

    full_file_path = os.path.join(folder, enc_name) #Set the file to maindir/name/name
    
    dev.log('Downloading '+videoid, 1)
    #vid = YDStreamExtractor.getVideoInfo(videoid,quality=1)
    path = os.path.join(movieLibrary, fold) #Set the folder to the maindir/dir
    
    
    #url = "https://www.youtube.com/watch?v=YKSU82afy1w" #ducktales intro to test
    url = "https://www.youtube.com/watch?v="+videoid
    vid = YDStreamExtractor.getVideoInfo(url,quality=1)
    
    if vid == None:
        dev.log('Failed to retrieve video from url: '+url)
        return False
    
    if settings.find('download_videos').text  == '720p':
        dev.log('%%%%%%% QUALITY: 720p quality selected')
        format = 'bestvideo[height<=?720]+bestaudio/best[height<=?720]'
    elif settings.find('download_videos').text == '1080p':
        dev.log('%%%%%%% QUALITY: 1080p quality selected')
        format = 'bestvideo[height<=?1080]+bestaudio/best[height<=?1080]'
    else:
        dev.log('%%%%%%% QUALITY: best quality selected')
        format = 'bestvideo+bestaudio/best'
    
    ydl_opts = {
    'format': format,
    'logger': MyLogger(),
    'progress_hooks': [my_hook],
    'outtmpl' : full_file_path+'.%(ext)s',
    #'-o' : enc_name+'.%(ext)s',
    }
    with youtube_dl.YoutubeDL(ydl_opts) as ydl:
        return ydl.download(['https://www.youtube.com/watch?v='+videoid])
    
    """
开发者ID:Sleuteltje,项目名称:plugin.video.youtubelibrary,代码行数:59,代码来源:play.py

示例11: play

# 需要导入模块: import YDStreamExtractor [as 别名]
# 或者: from YDStreamExtractor import getVideoInfo [as 别名]
def play(url):
    if url.find('linkOut') != -1:
        urlout = url.split('?id=')[-1]
        url = base64.b64decode(urlout)
        plugin.notify(msg=urlout, title=url)
    resolved = ''
    stream_url = ''
    item = None
    try:
        import urlresolver
        resolved = urlresolver.HostedMediaFile(url).resolve()
        if not resolved or resolved == False or len(resolved) < 1:
            resolved = urlresolver.resolve(url)
            if resolved is None or len(resolved) < 1:
                resolved = urlresolver.resolve(urllib.unquote(url))
        if len(resolved) > 1:
            plugin.notify(msg="PLAY {0}".format(resolved.partition('.')[-1]), title="URLRESOLVER", delay=1000)
            plugin.set_resolved_url(resolved)
            item = ListItem.from_dict(path=resolved)
            item.add_stream_info('video', stream_values={})
            item.set_is_playable(True)
            plugin.play_video(item)
            return None
    except:
        resolved = ''
        plugin.notify(msg="FAILED {0}".format(url.partition('.')[-1]), title="URLRESOLVER", delay=1000)
    try:
        import YDStreamExtractor
        info = YDStreamExtractor.getVideoInfo(url, resolve_redirects=True)
        resolved = info.streamURL()
        for s in info.streams():
            try:
                stream_url = s['xbmc_url'].encode('utf-8', 'ignore')
                xbmc.log(msg="**YOUTUBE-DL Stream found: {0}".format(stream_url))
            except:
                pass
        if len(stream_url) > 1:
            resolved = stream_url
        if len(resolved) > 1:
            plugin.notify(msg="Playing: {0}".format(resolved.partition('.')[-1]), title="YOUTUBE-DL", delay=1000)
            plugin.set_resolved_url(resolved)
            item = ListItem.from_dict(path=resolved)
            item.add_stream_info('video', stream_values={})
            item.set_is_playable(True)
            plugin.play_video(item)
            return None
    except:
        plugin.notify(msg="Failed: {0}".format(resolved.partition('.')[-1]), title="YOUTUBE-DL", delay=1000)
    if len(resolved) > 1:
        plugin.set_resolved_url(resolved)
        item = ListItem.from_dict(path=resolved)
        plugin.play_video(item)
        return None
    else:
        plugin.set_resolved_url(url)
        plugin.play_video(url)
        return None
开发者ID:moedje,项目名称:kodi-repo-gaymods,代码行数:59,代码来源:addon.py

示例12: handlePush

# 需要导入模块: import YDStreamExtractor [as 别名]
# 或者: from YDStreamExtractor import getVideoInfo [as 别名]
def handlePush(data, from_gui=False):
    if not from_gui and checkForWindow():  # Do nothing if the window is open
        return False
    if data.get("type") == "link":
        url = data.get("url", "")
        if StreamExtractor.mightHaveVideo(url):
            vid = StreamExtractor.getVideoInfo(url)
            if vid:
                if vid.hasMultipleStreams():
                    vlist = []
                    for info in vid.streams():
                        vlist.append(info["title"] or "?")
                    idx = xbmcgui.Dialog().select(common.localise(32091), vlist)
                    if idx < 0:
                        return
                    vid.selectStream(idx)
                playMedia(vid.streamURL(), vid.title, vid.thumbnail, vid.description)
                return True
        if canPlayURL(url):
            handleURL(url)
            return True
        media = getURLMediaType(url)
        if media == "video" or media == "audio":
            url += "|" + urllib.urlencode({"User-Agent": getURLUserAgent(url)})
            playMedia(url, playlist_type="video" and xbmc.PLAYLIST_VIDEO or xbmc.PLAYLIST_MUSIC)
            return True
        elif media == "image":
            import gui

            gui.showImage(url)
            return True
    elif data.get("type") == "file":
        if data.get("file_type", "").startswith("image/"):
            import gui

            gui.showImage(data.get("file_url", ""))
            return True
        elif data.get("file_type", "").startswith("video/") or data.get("file_type", "").startswith("audio/"):
            playMedia(data.get("file_url", ""))
            return True
    elif data.get("type") == "note":
        import gui

        gui.showNote(data.get("body", ""))
        return True
    elif data.get("type") == "list":
        import gui

        gui.showList(data)
        return True
    elif data.get("type") == "address":
        cmd = "XBMC.RunScript({0},MAP,{1},None,)".format(common.__addonid__, urllib.quote(data.get("address", "")))
        xbmc.executebuiltin(cmd)
        return True

    return False
开发者ID:rjof,项目名称:xbmc.service.pushbullet,代码行数:58,代码来源:pushhandler.py

示例13: play_trailer

# 需要导入模块: import YDStreamExtractor [as 别名]
# 或者: from YDStreamExtractor import getVideoInfo [as 别名]
def play_trailer(youtube_id="", listitem=None, popstack=False):
    if not listitem:
        listitem = xbmcgui.ListItem(xbmc.getLocalizedString(20410))
        listitem.setInfo('video', {'Title': xbmc.getLocalizedString(20410), 'Genre': 'Youtube Video'})
    import YDStreamExtractor
    YDStreamExtractor.disableDASHVideo(True)
    vid = YDStreamExtractor.getVideoInfo(youtube_id, quality=1)
    if vid:
        stream_url = vid.streamURL()
        PlayMedia(stream_url, listitem, popstack)
开发者ID:gitter-badger,项目名称:script.extendedinfo,代码行数:12,代码来源:Utils.py

示例14: play

# 需要导入模块: import YDStreamExtractor [as 别名]
# 或者: from YDStreamExtractor import getVideoInfo [as 别名]
def play(url):
    resolved = ''
    stream_url = ''
    item = None
    try:
        import urlresolver
        resolved = urlresolver.HostedMediaFile(url).resolve()
        if not resolved or resolved == False or len(resolved) < 1:
            resolved = urlresolver.resolve(url)
            if resolved is None or len(resolved) < 1:
                resolved = urlresolver.resolve(urllib.unquote(url))
        if len(resolved) > 1:
            plugin.notify(msg="PLAY {0}".format(resolved.partition('.')[-1]), title="URLRESOLVER", delay=1000)
            plugin.set_resolved_url(resolved)
            item = ListItem.from_dict(path=resolved)
            item.add_stream_info('video', stream_values={})
            item.set_is_playable(True)
            return item
    except:
        resolved = ''
        plugin.notify(msg="FAILED {0}".format(url.partition('.')[-1]), title="URLRESOLVER", delay=1000)
    try:
        import YDStreamExtractor
        info = YDStreamExtractor.getVideoInfo(url, resolve_redirects=True)
        resolved = info.streamURL()
        for s in info.streams():
            try:
                stream_url = s['xbmc_url'].encode('utf-8', 'ignore')
                xbmc.log(msg="**YOUTUBE-DL Stream found: {0}".format(stream_url))
            except:
                pass
        if len(stream_url) > 1:
            resolved = stream_url
        if len(resolved) > 1:
            plugin.notify(msg="Playing: {0}".format(resolved.partition('.')[-1]), title="YOUTUBE-DL", delay=1000)
            plugin.set_resolved_url(resolved)
            item = ListItem.from_dict(path=resolved)
            item.add_stream_info('video', stream_values={})
            item.set_is_playable(True)
            return item
    except:
        plugin.notify(msg="Failed: {0}".format(resolved.partition('.')[-1]), title="YOUTUBE-DL", delay=1000)

    if len(resolved) > 1:
        plugin.set_resolved_url(resolved)
        item = ListItem.from_dict(path=resolved)
        return item
    else:
        plugin.set_resolved_url(url) #url)
        #plugurl = 'plugin://plugin.video.live.streamspro/?url={0}'.format(urllib.quote_plus(url))
        #item = ListItem.from_dict(path=plugurl)
        #item.add_stream_info('video', stream_values={})
        #item.set_is_playable(True)
        #plugin.notify(msg="RESOLVE FAIL: {0}".format(url.split('.', 1)[-1]),title="Trying {0}".format(item.path.split('.', 1)[-1]), delay=2000)
        return None
开发者ID:moedje,项目名称:kodi-repo-gaymods,代码行数:57,代码来源:old_addon.py

示例15: PlayTrailer

# 需要导入模块: import YDStreamExtractor [as 别名]
# 或者: from YDStreamExtractor import getVideoInfo [as 别名]
def PlayTrailer(youtube_id="", listitem=None, popstack=False):
    if not listitem:
        listitem =xbmcgui.ListItem ('Trailer')
        listitem.setInfo('video', {'Title': 'Trailer', 'Genre': 'Youtube Video'})
    import YDStreamExtractor
    YDStreamExtractor.disableDASHVideo(True)
    vid = YDStreamExtractor.getVideoInfo(youtube_id, quality=1)
    if vid:
        stream_url = vid.streamURL()
        log("Youtube Trailer:" + stream_url)
        PlayMedia(stream_url, listitem, popstack)
开发者ID:LargeTalons,项目名称:script.extendedinfo,代码行数:13,代码来源:Utils.py


注:本文中的YDStreamExtractor.getVideoInfo方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。