1 # -*- coding: utf-8 -*-
2 from __future__ import unicode_literals
4 from .common import InfoExtractor
5 from ..compat import compat_parse_qs
14 class FolketingetIE(InfoExtractor):
15 IE_DESC = 'Folketinget (ft.dk; Danish parliament)'
16 _VALID_URL = r'https?://(?:www\.)?ft\.dk/webtv/video/[^?#]*?\.(?P<id>[0-9]+)\.aspx'
18 'url': 'http://www.ft.dk/webtv/video/20141/eru/td.1165642.aspx?as=1#player',
19 'md5': '6269e8626fa1a891bf5369b386ae996a',
23 'title': 'Åbent samråd i Erhvervsudvalget',
24 'description': 'Åbent samråd med erhvervs- og vækstministeren om regeringens politik på teleområdet',
29 'timestamp': 1416493800,
30 'upload_date': '20141120',
35 def _real_extract(self, url):
36 video_id = self._match_id(url)
37 webpage = self._download_webpage(url, video_id)
39 title = self._og_search_title(webpage)
40 description = self._html_search_regex(
41 r'(?s)<div class="video-item-agenda"[^>]*>(.*?)<',
42 webpage, 'description', fatal=False)
44 player_params = compat_parse_qs(self._search_regex(
45 r'<embed src="http://ft\.arkena\.tv/flash/ftplayer\.swf\?([^"]+)"',
46 webpage, 'player params'))
47 xml_url = player_params['xml'][0]
48 doc = self._download_xml(xml_url, video_id)
50 timestamp = parse_iso8601(xpath_text(doc, './/date'))
51 duration = parse_duration(xpath_text(doc, './/duration'))
52 width = int_or_none(xpath_text(doc, './/width'))
53 height = int_or_none(xpath_text(doc, './/height'))
54 view_count = int_or_none(xpath_text(doc, './/views'))
57 'format_id': n.attrib['bitrate'],
58 'url': xpath_text(n, './url', fatal=True),
59 'tbr': int_or_none(n.attrib['bitrate']),
60 } for n in doc.findall('.//streams/stream')]
61 self._sort_formats(formats)
67 'description': description,
68 'timestamp': timestamp,
72 'view_count': view_count,