mirror of
https://github.com/yt-dlp/yt-dlp.git
synced 2024-11-21 20:46:36 -05:00
[common] Add new helper function _match_id
This commit is contained in:
parent
f4b1c7adb8
commit
ed9266db90
2 changed files with 9 additions and 2 deletions
|
@ -22,8 +22,7 @@ class ABCIE(InfoExtractor):
|
||||||
}
|
}
|
||||||
|
|
||||||
def _real_extract(self, url):
|
def _real_extract(self, url):
|
||||||
mobj = re.match(self._VALID_URL, url)
|
video_id = self._match_id(url)
|
||||||
video_id = mobj.group('id')
|
|
||||||
webpage = self._download_webpage(url, video_id)
|
webpage = self._download_webpage(url, video_id)
|
||||||
|
|
||||||
urls_info_json = self._search_regex(
|
urls_info_json = self._search_regex(
|
||||||
|
|
|
@ -165,6 +165,14 @@ def suitable(cls, url):
|
||||||
cls._VALID_URL_RE = re.compile(cls._VALID_URL)
|
cls._VALID_URL_RE = re.compile(cls._VALID_URL)
|
||||||
return cls._VALID_URL_RE.match(url) is not None
|
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
|
@classmethod
|
||||||
def working(cls):
|
def working(cls):
|
||||||
"""Getter method for _WORKING."""
|
"""Getter method for _WORKING."""
|
||||||
|
|
Loading…
Reference in a new issue