2 from __future__ import unicode_literals
4 from .common import InfoExtractor
13 class HeiseIE(InfoExtractor):
14 _VALID_URL = r'https?://(?:www\.)?heise\.de/(?:[^/]+/)+[^/]+-(?P<id>[0-9]+)\.html'
16 'url': 'http://www.heise.de/video/artikel/Podcast-c-t-uplink-3-3-Owncloud-Tastaturen-Peilsender-Smartphone-2404147.html',
17 'md5': 'ffed432483e922e88545ad9f2f15d30e',
21 'title': "Podcast: c't uplink 3.3 – Owncloud / Tastaturen / Peilsender Smartphone",
22 'format_id': 'mp4_720p',
23 'timestamp': 1411812600,
24 'upload_date': '20140927',
25 'description': 'md5:c934cbfb326c669c2bcabcbe3d3fcd20',
26 'thumbnail': r're:^https?://.*/gallery/$',
29 'url': 'http://www.heise.de/ct/artikel/c-t-uplink-3-3-Owncloud-Tastaturen-Peilsender-Smartphone-2403911.html',
30 'only_matching': True,
32 'url': 'http://www.heise.de/newsticker/meldung/c-t-uplink-Owncloud-Tastaturen-Peilsender-Smartphone-2404251.html?wt_mc=rss.ho.beitrag.atom',
33 'only_matching': True,
35 'url': 'http://www.heise.de/ct/ausgabe/2016-12-Spiele-3214137.html',
36 'only_matching': True,
39 def _real_extract(self, url):
40 video_id = self._match_id(url)
41 webpage = self._download_webpage(url, video_id)
43 container_id = self._search_regex(
44 r'<div class="videoplayerjw"[^>]+data-container="([0-9]+)"',
45 webpage, 'container ID')
46 sequenz_id = self._search_regex(
47 r'<div class="videoplayerjw"[^>]+data-sequenz="([0-9]+)"',
48 webpage, 'sequenz ID')
50 title = self._html_search_meta('fulltitle', webpage, default=None)
51 if not title or title == "c't":
52 title = self._search_regex(
53 r'<div[^>]+class="videoplayerjw"[^>]+data-title="([^"]+)"',
56 doc = self._download_xml(
57 'http://www.heise.de/videout/feed', video_id, query={
58 'container': container_id,
59 'sequenz': sequenz_id,
63 for source_node in doc.findall('.//{http://rss.jwpcdn.com/}source'):
64 label = source_node.attrib['label']
65 height = int_or_none(self._search_regex(
66 r'^(.*?_)?([0-9]+)p$', label, 'height', default=None))
67 video_url = source_node.attrib['file']
68 ext = determine_ext(video_url, '')
72 'format_id': '%s_%s' % (ext, label),
75 self._sort_formats(formats)
77 description = self._og_search_description(
78 webpage, default=None) or self._html_search_meta(
79 'description', webpage)
84 'description': description,
85 'thumbnail': (xpath_text(doc, './/{http://rss.jwpcdn.com/}image') or
86 self._og_search_thumbnail(webpage)),
87 'timestamp': parse_iso8601(
88 self._html_search_meta('date', webpage)),