本文整理匯總了Python中YDStreamExtractor.downloadVideo方法的典型用法代碼示例。如果您正苦於以下問題:Python YDStreamExtractor.downloadVideo方法的具體用法?Python YDStreamExtractor.downloadVideo怎麽用?Python YDStreamExtractor.downloadVideo使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類YDStreamExtractor
的用法示例。
在下文中一共展示了YDStreamExtractor.downloadVideo方法的1個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Python代碼示例。
示例1: youtubeDLDownload
# 需要導入模塊: import YDStreamExtractor [as 別名]
# 或者: from YDStreamExtractor import downloadVideo [as 別名]
def youtubeDLDownload(self,vid,path,target=None):
import YDStreamExtractor as StreamExtractor
import YDStreamUtils as StreamUtils
if not target: target = self.chooseDirectory()
if not target: return
with StreamUtils.DownloadProgress() as prog:
try:
StreamExtractor.disableDASHVideo(True)
StreamExtractor.setOutputCallback(prog)
result = StreamExtractor.downloadVideo(vid,path)
finally:
StreamExtractor.setOutputCallback(None)
if not result and result.status != 'canceled':
xbmcgui.Dialog().ok(T(32103),'[CR]',result.message)
elif result:
xbmcgui.Dialog().ok(T(32062),T(32104),'[CR]',result.filepath)
if target:
xbmcvfs.copy(result.filepath,os.path.join(target,os.path.basename(result.filepath)))
xbmcvfs.delete(result.filepath)