mirror of
https://github.com/ytdl-org/youtube-dl.git
synced 2025-12-08 15:12:43 +01:00
Compare commits
8 Commits
2015.02.16
...
2015.02.17
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
46312e0b46 | ||
|
|
f9216ed6ad | ||
|
|
65bf37ef83 | ||
|
|
f740fae2a4 | ||
|
|
fbc503d696 | ||
|
|
662435f728 | ||
|
|
163d966707 | ||
|
|
85729c51af |
@@ -161,6 +161,8 @@ which means you can modify it, redistribute it or use it however you like.
|
|||||||
--playlist-reverse Download playlist videos in reverse order
|
--playlist-reverse Download playlist videos in reverse order
|
||||||
--xattr-set-filesize (experimental) set file xattribute
|
--xattr-set-filesize (experimental) set file xattribute
|
||||||
ytdl.filesize with expected filesize
|
ytdl.filesize with expected filesize
|
||||||
|
--hls-prefer-native (experimental) Use the native HLS
|
||||||
|
downloader instead of ffmpeg.
|
||||||
--external-downloader COMMAND (experimental) Use the specified external
|
--external-downloader COMMAND (experimental) Use the specified external
|
||||||
downloader. Currently supports
|
downloader. Currently supports
|
||||||
aria2c,curl,wget
|
aria2c,curl,wget
|
||||||
|
|||||||
@@ -225,7 +225,6 @@ class YoutubeDL(object):
|
|||||||
call_home: Boolean, true iff we are allowed to contact the
|
call_home: Boolean, true iff we are allowed to contact the
|
||||||
youtube-dl servers for debugging.
|
youtube-dl servers for debugging.
|
||||||
sleep_interval: Number of seconds to sleep before each download.
|
sleep_interval: Number of seconds to sleep before each download.
|
||||||
external_downloader: Executable of the external downloader to call.
|
|
||||||
listformats: Print an overview of available video formats and exit.
|
listformats: Print an overview of available video formats and exit.
|
||||||
list_thumbnails: Print a table of all thumbnails and exit.
|
list_thumbnails: Print a table of all thumbnails and exit.
|
||||||
match_filter: A function that gets called with the info_dict of
|
match_filter: A function that gets called with the info_dict of
|
||||||
@@ -235,6 +234,10 @@ class YoutubeDL(object):
|
|||||||
match_filter_func in utils.py is one example for this.
|
match_filter_func in utils.py is one example for this.
|
||||||
no_color: Do not emit color codes in output.
|
no_color: Do not emit color codes in output.
|
||||||
|
|
||||||
|
The following options determine which downloader is picked:
|
||||||
|
external_downloader: Executable of the external downloader to call.
|
||||||
|
None or unset for standard (built-in) downloader.
|
||||||
|
hls_prefer_native: Use the native HLS downloader instead of ffmpeg/avconv.
|
||||||
|
|
||||||
The following parameters are not used by YoutubeDL itself, they are used by
|
The following parameters are not used by YoutubeDL itself, they are used by
|
||||||
the FileDownloader:
|
the FileDownloader:
|
||||||
@@ -951,30 +954,9 @@ class YoutubeDL(object):
|
|||||||
return res
|
return res
|
||||||
|
|
||||||
def _calc_cookies(self, info_dict):
|
def _calc_cookies(self, info_dict):
|
||||||
class _PseudoRequest(object):
|
pr = compat_urllib_request.Request(info_dict['url'])
|
||||||
def __init__(self, url):
|
|
||||||
self.url = url
|
|
||||||
self.headers = {}
|
|
||||||
self.unverifiable = False
|
|
||||||
|
|
||||||
def add_unredirected_header(self, k, v):
|
|
||||||
self.headers[k] = v
|
|
||||||
|
|
||||||
def get_full_url(self):
|
|
||||||
return self.url
|
|
||||||
|
|
||||||
def is_unverifiable(self):
|
|
||||||
return self.unverifiable
|
|
||||||
|
|
||||||
def has_header(self, h):
|
|
||||||
return h in self.headers
|
|
||||||
|
|
||||||
def get_header(self, h, default=None):
|
|
||||||
return self.headers.get(h, default)
|
|
||||||
|
|
||||||
pr = _PseudoRequest(info_dict['url'])
|
|
||||||
self.cookiejar.add_cookie_header(pr)
|
self.cookiejar.add_cookie_header(pr)
|
||||||
return pr.headers.get('Cookie')
|
return pr.get_header('Cookie')
|
||||||
|
|
||||||
def process_video_result(self, info_dict, download=True):
|
def process_video_result(self, info_dict, download=True):
|
||||||
assert info_dict.get('_type', 'video') == 'video'
|
assert info_dict.get('_type', 'video') == 'video'
|
||||||
@@ -1298,7 +1280,7 @@ class YoutubeDL(object):
|
|||||||
downloaded = []
|
downloaded = []
|
||||||
success = True
|
success = True
|
||||||
merger = FFmpegMergerPP(self, not self.params.get('keepvideo'))
|
merger = FFmpegMergerPP(self, not self.params.get('keepvideo'))
|
||||||
if not merger.available():
|
if not merger.available:
|
||||||
postprocessors = []
|
postprocessors = []
|
||||||
self.report_warning('You have requested multiple '
|
self.report_warning('You have requested multiple '
|
||||||
'formats but ffmpeg or avconv are not installed.'
|
'formats but ffmpeg or avconv are not installed.'
|
||||||
|
|||||||
@@ -351,6 +351,7 @@ def _real_main(argv=None):
|
|||||||
'match_filter': match_filter,
|
'match_filter': match_filter,
|
||||||
'no_color': opts.no_color,
|
'no_color': opts.no_color,
|
||||||
'ffmpeg_location': opts.ffmpeg_location,
|
'ffmpeg_location': opts.ffmpeg_location,
|
||||||
|
'hls_prefer_native': opts.hls_prefer_native,
|
||||||
}
|
}
|
||||||
|
|
||||||
with YoutubeDL(ydl_opts) as ydl:
|
with YoutubeDL(ydl_opts) as ydl:
|
||||||
|
|||||||
@@ -34,6 +34,9 @@ def get_suitable_downloader(info_dict, params={}):
|
|||||||
if ed.supports(info_dict):
|
if ed.supports(info_dict):
|
||||||
return ed
|
return ed
|
||||||
|
|
||||||
|
if protocol == 'm3u8' and params.get('hls_prefer_native'):
|
||||||
|
return NativeHlsFD
|
||||||
|
|
||||||
return PROTOCOL_MAP.get(protocol, HttpFD)
|
return PROTOCOL_MAP.get(protocol, HttpFD)
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@@ -75,7 +75,7 @@ class ExternalFD(FileDownloader):
|
|||||||
|
|
||||||
class CurlFD(ExternalFD):
|
class CurlFD(ExternalFD):
|
||||||
def _make_cmd(self, tmpfilename, info_dict):
|
def _make_cmd(self, tmpfilename, info_dict):
|
||||||
cmd = [self.exe, '-o', tmpfilename]
|
cmd = [self.exe, '--location', '-o', tmpfilename]
|
||||||
for key, val in info_dict['http_headers'].items():
|
for key, val in info_dict['http_headers'].items():
|
||||||
cmd += ['--header', '%s: %s' % (key, val)]
|
cmd += ['--header', '%s: %s' % (key, val)]
|
||||||
cmd += self._source_address('--interface')
|
cmd += self._source_address('--interface')
|
||||||
|
|||||||
@@ -23,7 +23,7 @@ class HlsFD(FileDownloader):
|
|||||||
tmpfilename = self.temp_name(filename)
|
tmpfilename = self.temp_name(filename)
|
||||||
|
|
||||||
ffpp = FFmpegPostProcessor(downloader=self)
|
ffpp = FFmpegPostProcessor(downloader=self)
|
||||||
if not ffpp.available:
|
if not ffpp.available():
|
||||||
self.report_error('m3u8 download detected but ffmpeg or avconv could not be found. Please install one.')
|
self.report_error('m3u8 download detected but ffmpeg or avconv could not be found. Please install one.')
|
||||||
return False
|
return False
|
||||||
ffpp.check_version()
|
ffpp.check_version()
|
||||||
|
|||||||
@@ -424,6 +424,10 @@ def parseOpts(overrideArguments=None):
|
|||||||
'--xattr-set-filesize',
|
'--xattr-set-filesize',
|
||||||
dest='xattr_set_filesize', action='store_true',
|
dest='xattr_set_filesize', action='store_true',
|
||||||
help='(experimental) set file xattribute ytdl.filesize with expected filesize')
|
help='(experimental) set file xattribute ytdl.filesize with expected filesize')
|
||||||
|
downloader.add_option(
|
||||||
|
'--hls-prefer-native',
|
||||||
|
dest='hls_prefer_native', action='store_true',
|
||||||
|
help='(experimental) Use the native HLS downloader instead of ffmpeg.')
|
||||||
downloader.add_option(
|
downloader.add_option(
|
||||||
'--external-downloader',
|
'--external-downloader',
|
||||||
dest='external_downloader', metavar='COMMAND',
|
dest='external_downloader', metavar='COMMAND',
|
||||||
|
|||||||
@@ -34,10 +34,10 @@ class FFmpegPostProcessor(PostProcessor):
|
|||||||
self._determine_executables()
|
self._determine_executables()
|
||||||
|
|
||||||
def check_version(self):
|
def check_version(self):
|
||||||
if not self.available():
|
if not self.available:
|
||||||
raise FFmpegPostProcessorError('ffmpeg or avconv not found. Please install one.')
|
raise FFmpegPostProcessorError('ffmpeg or avconv not found. Please install one.')
|
||||||
|
|
||||||
required_version = '10-0' if self._uses_avconv() else '1.0'
|
required_version = '10-0' if self.basename == 'avconv' else '1.0'
|
||||||
if is_outdated_version(
|
if is_outdated_version(
|
||||||
self._versions[self.basename], required_version):
|
self._versions[self.basename], required_version):
|
||||||
warning = 'Your copy of %s is outdated, update %s to version %s or newer if you encounter any errors.' % (
|
warning = 'Your copy of %s is outdated, update %s to version %s or newer if you encounter any errors.' % (
|
||||||
@@ -108,12 +108,10 @@ class FFmpegPostProcessor(PostProcessor):
|
|||||||
self.probe_basename = p
|
self.probe_basename = p
|
||||||
break
|
break
|
||||||
|
|
||||||
|
@property
|
||||||
def available(self):
|
def available(self):
|
||||||
return self.basename is not None
|
return self.basename is not None
|
||||||
|
|
||||||
def _uses_avconv(self):
|
|
||||||
return self.basename == 'avconv'
|
|
||||||
|
|
||||||
@property
|
@property
|
||||||
def executable(self):
|
def executable(self):
|
||||||
return self._paths[self.basename]
|
return self._paths[self.basename]
|
||||||
|
|||||||
@@ -1,3 +1,3 @@
|
|||||||
from __future__ import unicode_literals
|
from __future__ import unicode_literals
|
||||||
|
|
||||||
__version__ = '2015.02.16.1'
|
__version__ = '2015.02.17'
|
||||||
|
|||||||
Reference in New Issue
Block a user