]>
Raphaƫl G. Git Repositories - youtubedl/blob - youtube_dl/extractor/discovery.py
1 from __future__
import unicode_literals
3 from .common
import InfoExtractor
8 from ..compat
import compat_str
11 class DiscoveryIE(InfoExtractor
):
12 _VALID_URL
= r
'http://www\.discovery\.com\/[a-zA-Z0-9\-]*/[a-zA-Z0-9\-]*/videos/(?P<id>[a-zA-Z0-9_\-]*)(?:\.htm)?'
14 'url': 'http://www.discovery.com/tv-shows/mythbusters/videos/mission-impossible-outtakes.htm',
18 'title': 'Mission Impossible Outtakes',
19 'description': ('Watch Jamie Hyneman and Adam Savage practice being'
20 ' each other -- to the point of confusing Jamie\'s dog -- and '
21 'don\'t miss Adam moon-walking as Jamie ... behind Jamie\'s'
24 'timestamp': 1303099200,
25 'upload_date': '20110418',
28 'skip_download': True, # requires ffmpeg
31 'url': 'http://www.discovery.com/tv-shows/mythbusters/videos/mythbusters-the-simpsons',
33 'id': 'mythbusters-the-simpsons',
34 'title': 'MythBusters: The Simpsons',
39 def _real_extract(self
, url
):
40 video_id
= self
._match
_id
(url
)
41 info
= self
._download
_json
(url
+ '?flat=1', video_id
)
43 video_title
= info
.get('playlist_title') or info
.get('video_title')
46 'id': compat_str(video_info
['id']),
47 'formats': self
._extract
_m
3u8_formats
(
48 video_info
['src'], video_id
, ext
='mp4',
49 note
='Download m3u8 information for video %d' % (idx
+ 1)),
50 'title': video_info
['title'],
51 'description': video_info
.get('description'),
52 'duration': parse_duration(video_info
.get('video_length')),
53 'webpage_url': video_info
.get('href'),
54 'thumbnail': video_info
.get('thumbnailURL'),
55 'alt_title': video_info
.get('secondary_title'),
56 'timestamp': parse_iso8601(video_info
.get('publishedDate')),
57 } for idx
, video_info
in enumerate(info
['playlist'])]
59 return self
.playlist_result(entries
, video_id
, video_title
)