aboutsummaryrefslogtreecommitdiff
path: root/youtube_dl/extractor/common.py
diff options
context:
space:
mode:
authorAllan Zhou <allanzp@gmail.com>2013-08-21 00:07:03 -0700
committerAllan Zhou <allanzp@gmail.com>2013-08-21 00:07:03 -0700
commita3f62b8255120acda6d429d2a3ce53b13e871c5d (patch)
tree6a1a8707369cd36654be4ef1deb044a1fcce01ba /youtube_dl/extractor/common.py
parent37b6d5f684d409365bbac6d3f2b8074b57e643a8 (diff)
parent6c3e6e88d3aaaea64ca3d96c005da654c89c8a3a (diff)
Merge remote-tracking branch 'upstream/master'
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 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):