本文整理汇总了Python中youtube_dl.YoutubeDL.params['verbose']方法的典型用法代码示例。如果您正苦于以下问题:Python YoutubeDL.params['verbose']方法的具体用法?Python YoutubeDL.params['verbose']怎么用?Python YoutubeDL.params['verbose']使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类youtube_dl.YoutubeDL
的用法示例。
在下文中一共展示了YoutubeDL.params['verbose']方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: download
# 需要导入模块: from youtube_dl import YoutubeDL [as 别名]
# 或者: from youtube_dl.YoutubeDL import params['verbose'] [as 别名]
def download(download):
"""Downloads the youtube video from the url
Args:
download: A DownloadRequest.
Returns:
A (file name, video title) tuple.
The file name is ONLY the file name, and does not include the file path.
"""
downloader = YoutubeDL()
downloader.add_default_info_extractors()
downloader.params['outtmpl'] = os.path.join(os.getcwd(),
'temp/%(id)s.%(ext)s')
downloader.params['verbose'] = True
downloader.params['cachedir'] = None
downloader.params['noplaylist'] = True
downloader.params['max_downloads'] = 1
if download.is_audio_only():
downloader.params['format'] = 'bestaudio'
else:
# We are only going to support downloading .mp4 videos.
downloader.params['format'] = 'mp4'
if download.get_force_mp4_filetype():
downloader.params['format'] = 'mp4'
info = downloader.extract_info(download.get_url())
file_name = downloader.prepare_filename(info)
file_name = file_name.encode('ascii', 'ignore')
title = info.get('title', os.path.basename(file_name))
return file_name, title