From a12318ed7e9a7f71e109eb74cc1e0e11ccab054e Mon Sep 17 00:00:00 2001 From: Laura Liberda Date: Thu, 10 Dec 2020 23:39:39 +0100 Subject: [PATCH] shie: _match_id_and_host helper --- haruhi_dl/extractor/common.py | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/haruhi_dl/extractor/common.py b/haruhi_dl/extractor/common.py index 1fea16398..c552473f1 100644 --- a/haruhi_dl/extractor/common.py +++ b/haruhi_dl/extractor/common.py @@ -3091,3 +3091,15 @@ class SelfhostedInfoExtractor(InfoExtractor): `webpage` is a string (the website contents, as downloaded by GenericIE) or None""" pass + + @classmethod + def _match_id_and_host(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) + if m is None: + if '_SH_VALID_URL_RE' not in cls.__dict__: + cls._SH_VALID_URL_RE = re.compile(cls._SH_VALID_URL) + m = cls._SH_VALID_URL_RE.match(url) + assert m + return compat_str(m.group('host')), compat_str(m.group('id'))