]>
Commit | Line | Data |
---|---|---|
f0da3f1e | 1 | # coding: utf-8 |
2 | from __future__ import unicode_literals | |
b1741831 | 3 | |
f0da3f1e | 4 | import calendar |
5 | import datetime | |
f0da3f1e | 6 | import re |
7 | ||
8 | from .common import InfoExtractor | |
9 | ||
10 | # audios on oe1.orf.at are only available for 7 days, so we can't | |
11 | # add tests. | |
12 | ||
13 | ||
14 | class OE1IE(InfoExtractor): | |
b1741831 PH |
15 | IE_DESC = 'oe1.orf.at' |
16 | _VALID_URL = r'http://oe1\.orf\.at/programm/(?P<id>[0-9]+)' | |
f0da3f1e | 17 | |
18 | def _real_extract(self, url): | |
19 | mobj = re.match(self._VALID_URL, url) | |
20 | show_id = mobj.group('id') | |
b1741831 PH |
21 | |
22 | data = self._download_json( | |
f0da3f1e | 23 | 'http://oe1.orf.at/programm/%s/konsole' % show_id, |
24 | show_id | |
b1741831 | 25 | ) |
f0da3f1e | 26 | |
27 | timestamp = datetime.datetime.strptime('%s %s' % ( | |
28 | data['item']['day_label'], | |
29 | data['item']['time'] | |
30 | ), '%d.%m.%Y %H:%M') | |
31 | unix_timestamp = calendar.timegm(timestamp.utctimetuple()) | |
32 | ||
33 | return { | |
34 | 'id': show_id, | |
35 | 'title': data['item']['title'], | |
36 | 'url': data['item']['url_stream'], | |
37 | 'ext': 'mp3', | |
b1741831 | 38 | 'description': data['item'].get('info'), |
f0da3f1e | 39 | 'timestamp': unix_timestamp |
40 | } |