]> gitweb @ CieloNegro.org - youtube-dl.git/commitdiff
Add function add_default_info_extractors to YoutubeDL
authorJaime Marquínez Ferrándiz <jaime.marquinez.ferrandiz@gmail.com>
Thu, 27 Jun 2013 21:51:06 +0000 (23:51 +0200)
committerJaime Marquínez Ferrándiz <jaime.marquinez.ferrandiz@gmail.com>
Thu, 27 Jun 2013 21:51:06 +0000 (23:51 +0200)
It adds to the list the ies returned by ge_extractors

test/test_download.py
youtube_dl/YoutubeDL.py
youtube_dl/__init__.py

index db43e99620a140cb09e760f9b4e37542f4deb81b..786ebba88a072c74c0596f66c6cb8052b7f3eaff 100644 (file)
@@ -14,7 +14,6 @@ import binascii
 sys.path.append(os.path.dirname(os.path.dirname(os.path.abspath(__file__))))
 
 import youtube_dl.YoutubeDL
-import youtube_dl.extractor
 from youtube_dl.utils import *
 
 PARAMETERS_FILE = os.path.join(os.path.dirname(os.path.abspath(__file__)), "parameters.json")
@@ -87,8 +86,7 @@ def generator(test_case):
         params.update(test_case.get('params', {}))
 
         ydl = YoutubeDL(params)
-        for ie in youtube_dl.extractor.gen_extractors():
-            ydl.add_info_extractor(ie)
+        ydl.add_default_info_extractors()
         finished_hook_called = set()
         def _hook(status):
             if status['status'] == 'finished':
index 9931c98e9fe02dc3fbcc90df7a01eaf9aa6e7fb9..d3281fed25c8a6b7d2476b662167691c93322c3a 100644 (file)
@@ -13,7 +13,7 @@ import time
 import traceback
 
 from .utils import *
-from .extractor import get_info_extractor
+from .extractor import get_info_extractor, gen_extractors
 from .FileDownloader import FileDownloader
 
 
@@ -113,6 +113,13 @@ class YoutubeDL(object):
         self._ies.append(ie)
         ie.set_downloader(self)
 
+    def add_default_info_extractors(self):
+        """
+        Add the InfoExtractors returned by gen_extractors to the end of the list
+        """
+        for ie in gen_extractors():
+            self.add_info_extractor(ie)
+
     def add_post_processor(self, pp):
         """Add a PostProcessor object to the end of the chain."""
         self._pps.append(pp)
index 34fccdd8cf4598f2ced205e04bfb729cabfbf836..6334ce3c42545ab08484fd36c0cc597bd3fd1c63 100644 (file)
@@ -573,8 +573,7 @@ def _real_main(argv=None):
         ydl.to_screen(u'[debug] Python version %s - %s' %(platform.python_version(), platform.platform()))
         ydl.to_screen(u'[debug] Proxy map: ' + str(proxy_handler.proxies))
 
-    for extractor in extractors:
-        ydl.add_info_extractor(extractor)
+    ydl.add_default_info_extractors()
 
     # PostProcessors
     if opts.extractaudio: