]>
Raphaƫl G. Git Repositories - youtubedl/blob - youtube_dl/extractor/discovery.py
1 from __future__
import unicode_literals
6 from .common
import InfoExtractor
9 class DiscoveryIE(InfoExtractor
):
10 _VALID_URL
= r
'http://dsc\.discovery\.com\/[a-zA-Z0-9\-]*/[a-zA-Z0-9\-]*/videos/(?P<id>[a-zA-Z0-9\-]*)(.htm)?'
12 'url': 'http://dsc.discovery.com/tv-shows/mythbusters/videos/mission-impossible-outtakes.htm',
14 'md5': 'e12614f9ee303a6ccef415cb0793eba2',
16 'title': 'MythBusters: Mission Impossible Outtakes',
17 'description': ('Watch Jamie Hyneman and Adam Savage practice being'
18 ' each other -- to the point of confusing Jamie\'s dog -- and '
19 'don\'t miss Adam moon-walking as Jamie ... behind Jamie\'s'
25 def _real_extract(self
, url
):
26 mobj
= re
.match(self
._VALID
_URL
, url
)
27 video_id
= mobj
.group('id')
28 webpage
= self
._download
_webpage
(url
, video_id
)
30 video_list_json
= self
._search
_regex
(r
'var videoListJSON = ({.*?});',
31 webpage
, 'video list', flags
=re
.DOTALL
)
32 video_list
= json
.loads(video_list_json
)
33 info
= video_list
['clips'][0]
37 {'url': f
['src'], r
'ext': r
'mp4', 'tbr': int(f
['bitrate'][:-1])})
40 'id': info
['contentId'],
41 'title': video_list
['name'],
43 'description': info
['videoCaption'],
44 'thumbnail': info
.get('videoStillURL') or info
.get('thumbnailURL'),
45 'duration': info
['duration'],