diff options
author | Filippo Valsorda <filippo.valsorda@gmail.com> | 2012-11-27 19:30:09 +0100 |
---|---|---|
committer | Filippo Valsorda <filippo.valsorda@gmail.com> | 2012-11-27 19:30:09 +0100 |
commit | 03c5b0fbd4de40ebf21a7ba2e389fb5fba50666c (patch) | |
tree | c1d8f77e4e70cb266e185f46ab920a2b2f58f211 | |
parent | 7e4674830ed0d85764792b1cd5605813643932b6 (diff) |
IE._WORKING attribute in order to warn the users and skip the tests on broken IEs
-rw-r--r-- | youtube_dl/FileDownloader.py | 5 | ||||
-rw-r--r-- | youtube_dl/InfoExtractors.py | 9 |
2 files changed, 14 insertions, 0 deletions
diff --git a/youtube_dl/FileDownloader.py b/youtube_dl/FileDownloader.py index 69d169904..1fdd2071f 100644 --- a/youtube_dl/FileDownloader.py +++ b/youtube_dl/FileDownloader.py @@ -481,6 +481,11 @@ class FileDownloader(object): if not ie.suitable(url): continue + # Warn if the _WORKING attribute is False + if not ie.working(): + self.trouble(u'WARNING: the program functionality for this site has been marked as broken, ' + u'and will probably not work. If you want to go on, use the -i option.') + # Suitable InfoExtractor found suitable_found = True diff --git a/youtube_dl/InfoExtractors.py b/youtube_dl/InfoExtractors.py index 4c664ce6e..7c6e1becc 100644 --- a/youtube_dl/InfoExtractors.py +++ b/youtube_dl/InfoExtractors.py @@ -63,10 +63,14 @@ class InfoExtractor(object): _real_extract() must return a *list* of information dictionaries as described above. + + Finally, the _WORKING attribute should be set to False for broken IEs + in order to warn the users and skip the tests. """ _ready = False _downloader = None + _WORKING = True def __init__(self, downloader=None): """Constructor. Receives an optional downloader.""" @@ -77,6 +81,10 @@ class InfoExtractor(object): """Receives a URL and returns True if suitable for this IE.""" return re.match(self._VALID_URL, url) is not None + def working(self): + """Getter method for _WORKING.""" + return self._WORKING + def initialize(self): """Initializes an instance (authentication, etc).""" if not self._ready: @@ -1891,6 +1899,7 @@ class DepositFilesIE(InfoExtractor): class FacebookIE(InfoExtractor): """Information Extractor for Facebook""" + _WORKING = False _VALID_URL = r'^(?:https?://)?(?:\w+\.)?facebook\.com/(?:video/video|photo)\.php\?(?:.*?)v=(?P<ID>\d+)(?:.*)' _LOGIN_URL = 'https://login.facebook.com/login.php?m&next=http%3A%2F%2Fm.facebook.com%2Fhome.php&' _NETRC_MACHINE = 'facebook' |