From ed9266db90023500e687aa634b55e11742c2e18c Mon Sep 17 00:00:00 2001 From: Philipp Hagemeister Date: Sun, 28 Sep 2014 09:31:58 +0200 Subject: [common] Add new helper function _match_id --- youtube_dl/extractor/common.py | 8 ++++++++ 1 file changed, 8 insertions(+) (limited to 'youtube_dl/extractor/common.py') diff --git a/youtube_dl/extractor/common.py b/youtube_dl/extractor/common.py index 403791e6b..8d6a6f601 100644 --- a/youtube_dl/extractor/common.py +++ b/youtube_dl/extractor/common.py @@ -165,6 +165,14 @@ class InfoExtractor(object): cls._VALID_URL_RE = re.compile(cls._VALID_URL) return cls._VALID_URL_RE.match(url) is not None + @classmethod + def _match_id(cls, url): + if '_VALID_URL_RE' not in cls.__dict__: + cls._VALID_URL_RE = re.compile(cls._VALID_URL) + m = cls._VALID_URL_RE.match(url) + assert m + return m.group('id') + @classmethod def working(cls): """Getter method for _WORKING.""" -- cgit v1.2.3