1 from __future__ import unicode_literals
6 from .common import InfoExtractor
7 from ..utils import int_or_none
10 class PodomaticIE(InfoExtractor):
15 (?P<channel>[^.]+)\.podomatic\.com/entry|
16 (?:www\.)?podomatic\.com/podcasts/(?P<channel_2>[^/]+)/episodes
22 'url': 'http://scienceteachingtips.podomatic.com/entry/2009-01-02T16_03_35-08_00',
23 'md5': '84bb855fcf3429e6bf72460e1eed782d',
25 'id': '2009-01-02T16_03_35-08_00',
27 'uploader': 'Science Teaching Tips',
28 'uploader_id': 'scienceteachingtips',
29 'title': '64. When the Moon Hits Your Eye',
33 'url': 'http://ostbahnhof.podomatic.com/entry/2013-11-15T16_31_21-08_00',
34 'md5': 'd2cf443931b6148e27638650e2638297',
36 'id': '2013-11-15T16_31_21-08_00',
38 'uploader': 'Ostbahnhof / Techno Mix',
39 'uploader_id': 'ostbahnhof',
40 'title': 'Einunddreizig',
44 'url': 'https://www.podomatic.com/podcasts/scienceteachingtips/episodes/2009-01-02T16_03_35-08_00',
45 'only_matching': True,
48 def _real_extract(self, url):
49 mobj = re.match(self._VALID_URL, url)
50 video_id = mobj.group('id')
51 channel = mobj.group('channel') or mobj.group('channel_2')
53 json_url = (('%s://%s.podomatic.com/entry/embed_params/%s' +
54 '?permalink=true&rtmp=0') %
55 (mobj.group('proto'), channel, video_id))
56 data_json = self._download_webpage(
57 json_url, video_id, 'Downloading video info')
58 data = json.loads(data_json)
60 video_url = data['downloadLink']
62 video_url = '%s/%s' % (data['streamer'].replace('rtmp', 'http'), data['mediaLocation'])
63 uploader = data['podcast']
65 thumbnail = data['imageLocation']
66 duration = int_or_none(data.get('length'), 1000)
73 'uploader_id': channel,
74 'thumbnail': thumbnail,