3 from .common
import InfoExtractor
14 class WikimediaIE(InfoExtractor
):
15 IE_NAME
= 'wikimedia.org'
16 _VALID_URL
= r
'https?://commons\.wikimedia\.org/wiki/File:(?P<id>[^/#?]+)\.\w+'
18 'url': 'https://commons.wikimedia.org/wiki/File:Die_Temperaturkurve_der_Erde_(ZDF,_Terra_X)_720p_HD_50FPS.webm',
20 'url': 're:https?://upload.wikimedia.org/wikipedia',
22 'id': 'Die_Temperaturkurve_der_Erde_(ZDF,_Terra_X)_720p_HD_50FPS',
23 'title': 'Die Temperaturkurve der Erde (ZDF, Terra X) 720p HD 50FPS.webm - Wikimedia Commons',
24 'description': 'md5:7cd84f76e7081f1be033d0b155b4a460',
25 'license': 'Creative Commons Attribution 4.0 International',
26 'uploader': 'ZDF/Terra X/Gruppe 5/Luise Wagner, Jonas Sichert, Andreas Hougardy',
27 'subtitles': 'count:4',
31 def _real_extract(self
, url
):
32 video_id
= self
._match
_id
(url
)
33 webpage
= self
._download
_webpage
(url
, video_id
)
36 for sub
in set(re
.findall(r
'\bsrc\s*=\s*["\'](/w
/api
[^
"]+)["\']', webpage)):
37 sub = urljoin('https
://commons
.wikimedia
.org
', unescapeHTML(sub))
39 lang = qs.get('lang
', [None])[-1]
40 sub_ext = qs.get('trackformat
', [None])[-1]
42 subtitles.setdefault(lang, []).append({'ext
': sub_ext, 'url
': sub})
46 'url
': self._html_search_regex(r'<source\s
[^
>]*\bsrc
="([^"]+)"', webpage, 'video URL'),
47 'description': clean_html(get_element_by_class('description', webpage)),
48 'title': remove_start(self._og_search_title(webpage), 'File:'),
49 'license': self._html_search_regex(
50 r'licensed under(?: the)? (.+?) license',
51 get_element_by_class('licensetpl', webpage), 'license', default=None),
52 'uploader': self._html_search_regex(
53 r'>\s*Author\s*</td>\s*<td\b[^>]*>\s*([^<]+)\s*</td>', webpage, 'video author', default=None),
54 'subtitles': subtitles,