diff options
author | Pierre Rudloff <pierre@rudloff.pro> | 2013-08-22 12:52:05 +0200 |
---|---|---|
committer | Pierre Rudloff <pierre@rudloff.pro> | 2013-08-22 12:52:05 +0200 |
commit | 8d212e604a86da3c924ab15fe8045ab748a8183d (patch) | |
tree | 5bc5588e5bbe7f8dad3fb1d0bbba354f2fb9e90c /youtube_dl/extractor/common.py | |
parent | 943f7f7a399c6fb3006eb2bd68070f28a272171f (diff) | |
parent | 063fcc9676718fc4395b92d6e9665e7f3e9c8156 (diff) |
Merge remote-tracking branch 'upstream/master'
Conflicts:
youtube_dl/extractor/jeuxvideo.py
Diffstat (limited to 'youtube_dl/extractor/common.py')
-rw-r--r-- | youtube_dl/extractor/common.py | 8 |
1 files changed, 7 insertions, 1 deletions
diff --git a/youtube_dl/extractor/common.py b/youtube_dl/extractor/common.py index da50abfc1..8009c2d85 100644 --- a/youtube_dl/extractor/common.py +++ b/youtube_dl/extractor/common.py @@ -77,7 +77,13 @@ class InfoExtractor(object): @classmethod def suitable(cls, url): """Receives a URL and returns True if suitable for this IE.""" - return re.match(cls._VALID_URL, url) is not None + + # This does not use has/getattr intentionally - we want to know whether + # we have cached the regexp for *this* class, whereas getattr would also + # match the superclass + if '_VALID_URL_RE' not in cls.__dict__: + cls._VALID_URL_RE = re.compile(cls._VALID_URL) + return cls._VALID_URL_RE.match(url) is not None @classmethod def working(cls): |