]>
Raphaƫl G. Git Repositories - youtubedl/blob - youtube_dl/extractor/podomatic.py
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>[^?]+)'
16 'url': 'http://scienceteachingtips.podomatic.com/entry/2009-01-02T16_03_35-08_00',
17 'md5': '84bb855fcf3429e6bf72460e1eed782d',
19 'id': '2009-01-02T16_03_35-08_00',
21 'uploader': 'Science Teaching Tips',
22 'uploader_id': 'scienceteachingtips',
23 'title': '64. When the Moon Hits Your Eye',
28 'url': 'http://ostbahnhof.podomatic.com/entry/2013-11-15T16_31_21-08_00',
29 'md5': 'd2cf443931b6148e27638650e2638297',
31 'id': '2013-11-15T16_31_21-08_00',
33 'uploader': 'Ostbahnhof / Techno Mix',
34 'uploader_id': 'ostbahnhof',
35 'title': 'Einunddreizig',
41 def _real_extract(self
, url
):
42 mobj
= re
.match(self
._VALID
_URL
, url
)
43 video_id
= mobj
.group('id')
44 channel
= mobj
.group('channel')
46 json_url
= (('%s://%s.podomatic.com/entry/embed_params/%s' +
47 '?permalink=true&rtmp=0') %
48 (mobj
.group('proto'), channel
, video_id
))
49 data_json
= self
._download
_webpage
(
50 json_url
, video_id
, 'Downloading video info')
51 data
= json
.loads(data_json
)
53 video_url
= data
['downloadLink']
55 video_url
= '%s/%s' % (data
['streamer'].replace('rtmp', 'http'), data
['mediaLocation'])
56 uploader
= data
['podcast']
58 thumbnail
= data
['imageLocation']
59 duration
= int_or_none(data
.get('length'), 1000)
66 'uploader_id': channel
,
67 'thumbnail': thumbnail
,