diff options
Diffstat (limited to 'yt_dlp/extractor/videocampus_sachsen.py')
-rw-r--r-- | yt_dlp/extractor/videocampus_sachsen.py | 34 |
1 files changed, 17 insertions, 17 deletions
diff --git a/yt_dlp/extractor/videocampus_sachsen.py b/yt_dlp/extractor/videocampus_sachsen.py index 37bc7d7..6f98c68 100644 --- a/yt_dlp/extractor/videocampus_sachsen.py +++ b/yt_dlp/extractor/videocampus_sachsen.py @@ -70,11 +70,11 @@ class VideocampusSachsenIE(InfoExtractor): 'www.wenglor-media.com', 'www2.univ-sba.dz', ) - _VALID_URL = r'''(?x)https?://(?P<host>%s)/(?: + _VALID_URL = r'''(?x)https?://(?P<host>{})/(?: m/(?P<tmp_id>[0-9a-f]+)| - (?:category/)?video/(?P<display_id>[\w-]+)/(?P<id>[0-9a-f]{32})| - media/embed.*(?:\?|&)key=(?P<embed_id>[0-9a-f]{32}&?) - )''' % ('|'.join(map(re.escape, _INSTANCES))) + (?:category/)?video/(?P<display_id>[\w-]+)/(?P<id>[0-9a-f]{{32}})| + media/embed.*(?:\?|&)key=(?P<embed_id>[0-9a-f]{{32}}&?) + )'''.format('|'.join(map(re.escape, _INSTANCES))) _TESTS = [ { @@ -119,7 +119,7 @@ class VideocampusSachsenIE(InfoExtractor): 'thumbnail': 'https://www2.univ-sba.dz/cache/4d5d4a0b4189271a8cc6cb5328e14769.jpg', 'display_id': 'Presentation-de-la-Faculte-de-droit-et-des-sciences-politiques-Journee-portes-ouvertes-202122', 'ext': 'mp4', - } + }, }, { 'url': 'https://vimp.weka-fachmedien.de/video/Preisverleihung-Produkte-des-Jahres-2022/c8816f1cc942c12b6cce57c835cffd7c', @@ -187,10 +187,10 @@ class VideocampusSachsenIE(InfoExtractor): class ViMPPlaylistIE(InfoExtractor): IE_NAME = 'ViMP:Playlist' - _VALID_URL = r'''(?x)(?P<host>https?://(?:%s))/(?: + _VALID_URL = r'''(?x)(?P<host>https?://(?:{}))/(?: album/view/aid/(?P<album_id>[0-9]+)| (?P<mode>category|channel)/(?P<name>[\w-]+)/(?P<id>[0-9]+) - )''' % '|'.join(map(re.escape, VideocampusSachsenIE._INSTANCES)) + )'''.format('|'.join(map(re.escape, VideocampusSachsenIE._INSTANCES))) _TESTS = [{ 'url': 'https://vimp.oth-regensburg.de/channel/Designtheorie-1-SoSe-2020/3', @@ -216,9 +216,9 @@ class ViMPPlaylistIE(InfoExtractor): }] _PAGE_SIZE = 10 - def _fetch_page(self, host, url_part, id, data, page): + def _fetch_page(self, host, url_part, playlist_id, data, page): webpage = self._download_webpage( - f'{host}/media/ajax/component/boxList/{url_part}', id, + f'{host}/media/ajax/component/boxList/{url_part}', playlist_id, query={'page': page, 'page_only': 1}, data=urlencode_postdata(data)) urls = re.findall(r'"([^"]+/video/[^"]+)"', webpage) @@ -226,28 +226,28 @@ class ViMPPlaylistIE(InfoExtractor): yield self.url_result(host + url, VideocampusSachsenIE) def _real_extract(self, url): - host, album_id, mode, name, id = self._match_valid_url(url).group( + host, album_id, mode, name, playlist_id = self._match_valid_url(url).group( 'host', 'album_id', 'mode', 'name', 'id') - webpage = self._download_webpage(url, album_id or id, fatal=False) or '' + webpage = self._download_webpage(url, album_id or playlist_id, fatal=False) or '' title = (self._html_search_meta('title', webpage, fatal=False) or self._html_extract_title(webpage)) url_part = (f'aid/{album_id}' if album_id - else f'category/{name}/category_id/{id}' if mode == 'category' - else f'title/{name}/channel/{id}') + else f'category/{name}/category_id/{playlist_id}' if mode == 'category' + else f'title/{name}/channel/{playlist_id}') mode = mode or 'album' data = { 'vars[mode]': mode, - f'vars[{mode}]': album_id or id, + f'vars[{mode}]': album_id or playlist_id, 'vars[context]': '4' if album_id else '1' if mode == 'category' else '3', - 'vars[context_id]': album_id or id, + 'vars[context_id]': album_id or playlist_id, 'vars[layout]': 'thumb', 'vars[per_page][thumb]': str(self._PAGE_SIZE), } return self.playlist_result( OnDemandPagedList(functools.partial( - self._fetch_page, host, url_part, album_id or id, data), self._PAGE_SIZE), - playlist_title=title, id=f'{mode}-{album_id or id}') + self._fetch_page, host, url_part, album_id or playlist_id, data), self._PAGE_SIZE), + playlist_title=title, id=f'{mode}-{album_id or playlist_id}') |