aboutsummaryrefslogtreecommitdiff
path: root/youtube_dl/extractor/common.py
diff options
context:
space:
mode:
authorIsmael Mejia <iemejia@gmail.com>2013-08-22 23:29:36 +0200
committerIsmael Mejia <iemejia@gmail.com>2013-08-22 23:29:36 +0200
commit18b4e04f1c663e0ea695f6501b860f85af9d7ca1 (patch)
treed60ebbf51b8c50f808c6c251fc6c02547052a9dc /youtube_dl/extractor/common.py
parentd80a064eff4fe2416f9db36b07f1e2ca641f1334 (diff)
parent1865ed31b955795f9859df5c1c400d172ae9a28a (diff)
Merge branch 'master' into subtitles_rework
Diffstat (limited to 'youtube_dl/extractor/common.py')
-rw-r--r--youtube_dl/extractor/common.py8
1 files changed, 7 insertions, 1 deletions
diff --git a/youtube_dl/extractor/common.py b/youtube_dl/extractor/common.py
index e2e192bef..52c4483c9 100644
--- a/youtube_dl/extractor/common.py
+++ b/youtube_dl/extractor/common.py
@@ -78,7 +78,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):