diff --git a/youtube_dl/extractor/wikimedia.py b/youtube_dl/extractor/wikimedia.py index fec867a12..290db6baf 100644 --- a/youtube_dl/extractor/wikimedia.py +++ b/youtube_dl/extractor/wikimedia.py @@ -10,6 +10,14 @@ class WikimediaIE(InfoExtractor): _API_BASE_URL = 'https://commons.wikimedia.org/' _VALID_URL = r'https://commons.wikimedia.org/wiki/File:(?P[^/]+)' + _TEST = { + 'url': 'https://upload.wikimedia.org/wikipedia/commons/transcoded/d/d7/Die_Temperaturkurve_der_Erde_%28ZDF' + '%2C_Terra_X%29_720p_HD_50FPS.webm/Die_Temperaturkurve_der_Erde_%28ZDF%2C_Terra_X%29_720p_HD_50FPS' + '.webm.480p.vp9.webm', + 'ext': 'webm', 'id': 'Die_Temperaturkurve_der_Erde_(ZDF,_Terra_X)_720p_HD_50FPS.webm', + 'title': 'Die_Temperaturkurve_der_Erde_(ZDF,_Terra_X)_720p_HD_50FPS.webm', + 'license': 'This file is licensed under the Creative Commons Attribution 4.0 International license.'} + def _real_extract(self, url): mobj = re.match(self._VALID_URL, url) video_id = mobj.group('id') @@ -18,6 +26,8 @@ class WikimediaIE(InfoExtractor): self.report_extraction(video_id) video_url = self._html_search_regex(r']*src="([^"]+)"', webpage, u'video URL') + licenze = self._html_search_regex(f"(?<=td>This)(.*)(?=license.)", webpage, u'video license') + licenze = "This " + licenze + " license." resp = {} subtitle_url = f'https://commons.wikimedia.org/w/api.php?' \ @@ -32,4 +42,5 @@ class WikimediaIE(InfoExtractor): resp['ext'] = 'webm' resp['id'] = video_id resp['title'] = video_id + resp['license'] = licenze return [resp]