Browse Source

[common] Add new helper function _match_id

totalwebcasting
Philipp Hagemeister 10 years ago
parent
commit
ed9266db90
2 changed files with 9 additions and 2 deletions
  1. +1
    -2
      youtube_dl/extractor/abc.py
  2. +8
    -0
      youtube_dl/extractor/common.py

+ 1
- 2
youtube_dl/extractor/abc.py View File

@ -22,8 +22,7 @@ class ABCIE(InfoExtractor):
}
def _real_extract(self, url):
mobj = re.match(self._VALID_URL, url)
video_id = mobj.group('id')
video_id = self._match_id(url)
webpage = self._download_webpage(url, video_id)
urls_info_json = self._search_regex(


+ 8
- 0
youtube_dl/extractor/common.py View File

@ -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."""


Loading…
Cancel
Save