本文整理汇总了Python中YDStreamExtractor类的典型用法代码示例。如果您正苦于以下问题:Python YDStreamExtractor类的具体用法?Python YDStreamExtractor怎么用?Python YDStreamExtractor使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了YDStreamExtractor类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: download_video
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)
示例2: showVideo
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'}})
示例3: PlayTrailer
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)
示例4: play_trailer
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)
示例5: PlayTrailer
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)
示例6: playVideo
def playVideo(name, url):
import YDStreamExtractor
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
# url = "https://www.youtube.com/watch?v=" + url #a youtube ID will work as well and of course you could pass the url of another site
vid = YDStreamExtractor.getVideoInfo(url,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
print "stream_url =", stream_url
img = " "
listitem = xbmcgui.ListItem(name, iconImage=img, thumbnailImage=img)
playfile = xbmc.Player()
playfile.play(stream_url, listitem)
示例7: _download
def _download(info, background=True):
if background:
YDStreamExtractor.handleDownload(info, bg=True)
else:
result = YDStreamExtractor.handleDownload(info, bg=False)
if result:
log_utils.log('Download complete: |%s|' % result.filepath)
elif result.status != 'canceled':
log_utils.log('Download failed: |%s|' % result.message, log_utils.LOGERROR)
kodi.notify(msg=result.message, sound=True)
else:
log_utils.log('Download cancelled')
示例8: playYoutubeVideo
def playYoutubeVideo(self, youtube_id="", listitem=None, popstack=True):
if not listitem:
listitem = xbmcgui.ListItem(xbmc.getLocalizedString(20410))
listitem.setInfo('video', {'Title': xbmc.getLocalizedString(20410), 'Genre': 'Youtube Video'})
import YDStreamExtractor
YDStreamExtractor.disableDASHVideo(True)
if youtube_id:
vid = YDStreamExtractor.getVideoInfo(youtube_id, quality=1)
if vid:
stream_url = vid.streamURL()
self.play(stream_url, listitem)
else:
Notify("no youtube id found")
示例9: resolve
def resolve(self,url):
html = client.request(url)
soup = webutils.bs(html)
video=soup.find('iframe')['src']
if 'youtube' in video:
yt_id = self.yt_video_id(video)
l = 'http://www.youtube.com/watch?v=' + yt_id
import YDStreamExtractor
YDStreamExtractor.disableDASHVideo(True)
vid = YDStreamExtractor.getVideoInfo(l,quality=1)
resolved = vid.streamURL()
return resolved
示例10: playYoutubeVideo
def playYoutubeVideo(self, youtube_id="", listitem=None, popstack=True):
if not listitem:
listitem = xbmcgui.ListItem ('Trailer')
listitem.setInfo('video', {'Title': listitem.getProperty('Label'), 'Plot': listitem.getProperty('Description'), 'Genre': 'Youtube Video'})
import YDStreamExtractor
YDStreamExtractor.disableDASHVideo(True)
if youtube_id:
vid = YDStreamExtractor.getVideoInfo(youtube_id, quality=1)
if vid:
stream_url = vid.streamURL()
log("Youtube Trailer:" + stream_url)
self.play(stream_url, listitem)
else:
Notify("no youtube id found")
示例11: getExtURL
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
示例12: fullInfo
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()
示例13: playYoutubeVid
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)
示例14: playYoutubeVid
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)
示例15: get_video_info
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