X-Git-Url: http://git.bitcoin.ninja/index.cgi?p=youtube-dl;a=blobdiff_plain;f=youtube_dl%2Fextractor%2Fcommon.py;h=52c4483c9ecafe914270444b848ba8ac5966f802;hp=e2e192beff593b4768c626e6df94e61a20dbf04e;hb=18b4e04f1c663e0ea695f6501b860f85af9d7ca1;hpb=d80a064eff4fe2416f9db36b07f1e2ca641f1334 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):