From 57bf4ce6d06db4b235ed6f88105776f25d1409a2 Mon Sep 17 00:00:00 2001 From: Itay Brandes Date: Sat, 14 Dec 2013 10:43:32 +0200 Subject: [PATCH 1/2] Exclude parameter for the add_default_info_extractors function We should add an exclude parameter for the add_default_info_extractors function, just in case we want to exclude a specific IE --- youtube_dl/YoutubeDL.py | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/youtube_dl/YoutubeDL.py b/youtube_dl/YoutubeDL.py index c77777ba0..b5ab7281d 100644 --- a/youtube_dl/YoutubeDL.py +++ b/youtube_dl/YoutubeDL.py @@ -218,12 +218,13 @@ class YoutubeDL(object): self.add_info_extractor(ie) return ie - def add_default_info_extractors(self): + def add_default_info_extractors(self, exclude=[]): """ Add the InfoExtractors returned by gen_extractors to the end of the list """ for ie in gen_extractors(): - self.add_info_extractor(ie) + if not ie.__class__.__name__ in exclude: + self.add_info_extractor(ie) def add_post_processor(self, pp): """Add a PostProcessor object to the end of the chain.""" From cf2b11eb09a5c6d5bef31d87e39e66c81202b990 Mon Sep 17 00:00:00 2001 From: Itay Brandes Date: Sat, 14 Dec 2013 17:40:51 +0200 Subject: [PATCH 2/2] _search_regex's "isatty" call fails with Py2exe's _search_regex calls the sys.stderr.isatty() function for unix systems. Py2exe uses a custom Stderr() stream which doesn't have an `isatty()` function, leading to it's crash. Fixes easily with checking that it's a unix system first. --- youtube_dl/extractor/common.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/youtube_dl/extractor/common.py b/youtube_dl/extractor/common.py index 69a083b68..bbfaab2d0 100644 --- a/youtube_dl/extractor/common.py +++ b/youtube_dl/extractor/common.py @@ -292,7 +292,7 @@ class InfoExtractor(object): mobj = re.search(p, string, flags) if mobj: break - if sys.stderr.isatty() and os.name != 'nt': + if os.name != 'nt' and sys.stderr.isatty(): _name = u'\033[0;34m%s\033[0m' % name else: _name = name