[InfoExtractor] Add _match_valid_url() class method and refactor

* API compatible with yt-dlp
* also support Sequence of patterns in _VALID_URL
* one place to compile _VALID_URL
* TODO: remove existing extractor shims
This commit is contained in:
dirkf
2023-07-19 14:14:50 +01:00
parent a190b55964
commit b2ba24bb02
3 changed files with 49 additions and 22 deletions

View File

@@ -18,12 +18,6 @@ from ..utils import (
class GlobalPlayerBaseIE(InfoExtractor):
import re
@classmethod
def _match_valid_url(cls, url):
return cls.re.match(cls._VALID_URL, url)
def _get_page_props(self, url, video_id):
webpage = self._download_webpage(url, video_id)
return self._search_nextjs_data(webpage, video_id)['props']['pageProps']