2 from __future__ import unicode_literals
6 from .common import InfoExtractor
8 # audios on fm4.orf.at are only available for 7 days, so we can't
12 class FM4IE(InfoExtractor):
13 IE_DESC = 'fm4.orf.at'
14 _VALID_URL = r'http://fm4\.orf\.at/7tage/?#(?P<date>[0-9]+)/(?P<show>\w+)'
16 def _real_extract(self, url):
17 mobj = re.match(self._VALID_URL, url)
18 show_date = mobj.group('date')
19 show_id = mobj.group('show')
21 data = self._download_json(
22 'http://audioapi.orf.at/fm4/json/2.0/broadcasts/%s/4%s' % (show_date, show_id),
26 def extract_entry_dict(info, title, subtitle):
28 'id': info['loopStreamId'].replace('.mp3', ''),
29 'url': 'http://loopstream01.apa.at/?channel=fm4&id=%s' % info['loopStreamId'],
31 'description': subtitle,
32 'duration': (info['end'] - info['start']) / 1000,
33 'timestamp': info['start'] / 1000,
37 entries = [extract_entry_dict(t, data['title'], data['subtitle']) for t in data['streams']]
42 'title': data['title'],
43 'description': data['subtitle'],