1 from __future__ import unicode_literals
6 from .common import InfoExtractor
7 from ..utils import int_or_none
10 class PodomaticIE(InfoExtractor):
12 _VALID_URL = r'^(?P<proto>https?)://(?P<channel>[^.]+)\.podomatic\.com/entry/(?P<id>[^?]+)'
15 "url": "http://scienceteachingtips.podomatic.com/entry/2009-01-02T16_03_35-08_00",
16 "file": "2009-01-02T16_03_35-08_00.mp3",
17 "md5": "84bb855fcf3429e6bf72460e1eed782d",
19 "uploader": "Science Teaching Tips",
20 "uploader_id": "scienceteachingtips",
21 "title": "64. When the Moon Hits Your Eye",
26 def _real_extract(self, url):
27 mobj = re.match(self._VALID_URL, url)
28 video_id = mobj.group('id')
29 channel = mobj.group('channel')
31 json_url = (('%s://%s.podomatic.com/entry/embed_params/%s' +
32 '?permalink=true&rtmp=0') %
33 (mobj.group('proto'), channel, video_id))
34 data_json = self._download_webpage(
35 json_url, video_id, note=u'Downloading video info')
36 data = json.loads(data_json)
38 video_url = data['downloadLink']
39 uploader = data['podcast']
41 thumbnail = data['imageLocation']
42 duration = int_or_none(data.get('length'), 1000)
49 'uploader_id': channel,
50 'thumbnail': thumbnail,