projects
/
youtube-dl
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
lazy extractors: Output if it's enabled in the verbose log
[youtube-dl]
/
youtube_dl
/
YoutubeDL.py
diff --git
a/youtube_dl/YoutubeDL.py
b/youtube_dl/YoutubeDL.py
index 33c269f9c41481a49c98590e18ab829e517492c4..a89a71a250e3c02cb1157bfc0970e308474e4e89 100755
(executable)
--- a/
youtube_dl/YoutubeDL.py
+++ b/
youtube_dl/YoutubeDL.py
@@
-39,6
+39,8
@@
from .compat import (
compat_urllib_request_DataHandler,
)
from .utils import (
compat_urllib_request_DataHandler,
)
from .utils import (
+ age_restricted,
+ args_to_str,
ContentTooShortError,
date_from_str,
DateRange,
ContentTooShortError,
date_from_str,
DateRange,
@@
-58,10
+60,12
@@
from .utils import (
PagedList,
parse_filesize,
PerRequestProxyHandler,
PagedList,
parse_filesize,
PerRequestProxyHandler,
- PostProcessingError,
platform_name,
platform_name,
+ PostProcessingError,
preferredencoding,
preferredencoding,
+ prepend_extension,
render_table,
render_table,
+ replace_extension,
SameFileError,
sanitize_filename,
sanitize_path,
SameFileError,
sanitize_filename,
sanitize_path,
@@
-76,13
+80,9
@@
from .utils import (
write_string,
YoutubeDLCookieProcessor,
YoutubeDLHandler,
write_string,
YoutubeDLCookieProcessor,
YoutubeDLHandler,
- prepend_extension,
- replace_extension,
- args_to_str,
- age_restricted,
)
from .cache import Cache
)
from .cache import Cache
-from .extractor import get_info_extractor, gen_extractor
s
+from .extractor import get_info_extractor, gen_extractor
_classes, _LAZY_LOADER
from .downloader import get_suitable_downloader
from .downloader.rtmp import rtmpdump_version
from .postprocessor import (
from .downloader import get_suitable_downloader
from .downloader.rtmp import rtmpdump_version
from .postprocessor import (
@@
-378,8
+378,9
@@
class YoutubeDL(object):
def add_info_extractor(self, ie):
"""Add an InfoExtractor object to the end of the list."""
self._ies.append(ie)
def add_info_extractor(self, ie):
"""Add an InfoExtractor object to the end of the list."""
self._ies.append(ie)
- self._ies_instances[ie.ie_key()] = ie
- ie.set_downloader(self)
+ if not isinstance(ie, type):
+ self._ies_instances[ie.ie_key()] = ie
+ ie.set_downloader(self)
def get_info_extractor(self, ie_key):
"""
def get_info_extractor(self, ie_key):
"""
@@
-397,7
+398,7
@@
class YoutubeDL(object):
"""
Add the InfoExtractors returned by gen_extractors to the end of the list
"""
"""
Add the InfoExtractors returned by gen_extractors to the end of the list
"""
- for ie in gen_extractors():
+ for ie in gen_extractor
_classe
s():
self.add_info_extractor(ie)
def add_post_processor(self, pp):
self.add_info_extractor(ie)
def add_post_processor(self, pp):
@@
-661,6
+662,7
@@
class YoutubeDL(object):
if not ie.suitable(url):
continue
if not ie.suitable(url):
continue
+ ie = self.get_info_extractor(ie.ie_key())
if not ie.working():
self.report_warning('The program functionality for this site has been marked as broken, '
'and will probably not work.')
if not ie.working():
self.report_warning('The program functionality for this site has been marked as broken, '
'and will probably not work.')
@@
-1240,7
+1242,10
@@
class YoutubeDL(object):
self.list_thumbnails(info_dict)
return
self.list_thumbnails(info_dict)
return
- if thumbnails and 'thumbnail' not in info_dict:
+ thumbnail = info_dict.get('thumbnail')
+ if thumbnail:
+ info_dict['thumbnail'] = sanitize_url(thumbnail)
+ elif thumbnails:
info_dict['thumbnail'] = thumbnails[-1]['url']
if 'display_id' not in info_dict and 'id' in info_dict:
info_dict['thumbnail'] = thumbnails[-1]['url']
if 'display_id' not in info_dict and 'id' in info_dict:
@@
-1265,7
+1270,8
@@
class YoutubeDL(object):
if subtitles:
for _, subtitle in subtitles.items():
for subtitle_format in subtitle:
if subtitles:
for _, subtitle in subtitles.items():
for subtitle_format in subtitle:
- subtitle_format['url'] = sanitize_url(subtitle_format['url'])
+ if subtitle_format.get('url'):
+ subtitle_format['url'] = sanitize_url(subtitle_format['url'])
if 'ext' not in subtitle_format:
subtitle_format['ext'] = determine_ext(subtitle_format['url']).lower()
if 'ext' not in subtitle_format:
subtitle_format['ext'] = determine_ext(subtitle_format['url']).lower()
@@
-1953,6
+1959,8
@@
class YoutubeDL(object):
write_string(encoding_str, encoding=None)
self._write_string('[debug] youtube-dl version ' + __version__ + '\n')
write_string(encoding_str, encoding=None)
self._write_string('[debug] youtube-dl version ' + __version__ + '\n')
+ if _LAZY_LOADER:
+ self._write_string('[debug] Lazy loading extractors enabled' + '\n')
try:
sp = subprocess.Popen(
['git', 'rev-parse', '--short', 'HEAD'],
try:
sp = subprocess.Popen(
['git', 'rev-parse', '--short', 'HEAD'],