]>
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
'''(?x)http://(?:www\.)?(?:
14 investigationdiscovery|
22 )\.com/(?:[^/]+/)*(?P<id>[^./?#]+)'''
24 'url' : 'http://www.discovery.com/tv-shows/mythbusters/videos/mission-impossible-outtakes.htm' ,
28 'title' : 'Mission Impossible Outtakes' ,
29 'description' : ( 'Watch Jamie Hyneman and Adam Savage practice being'
30 ' each other -- to the point of confusing Jamie \' s dog -- and '
31 'don \' t miss Adam moon-walking as Jamie ... behind Jamie \' s'
34 'timestamp' : 1302032462 ,
35 'upload_date' : '20110405' ,
38 'skip_download' : True , # requires ffmpeg
41 'url' : 'http://www.discovery.com/tv-shows/mythbusters/videos/mythbusters-the-simpsons' ,
43 'id' : 'mythbusters-the-simpsons' ,
44 'title' : 'MythBusters: The Simpsons' ,
46 'playlist_mincount' : 10 ,
48 'url' : 'http://www.animalplanet.com/longfin-eels-maneaters/' ,
52 'title' : 'Longfin Eels: Maneaters?' ,
53 'description' : 'Jeremy Wade tests whether or not New Zealand \' s longfin eels are man-eaters by covering himself in fish guts and getting in the water with them.' ,
54 'upload_date' : '20140725' ,
55 'timestamp' : 1406246400 ,
60 def _real_extract ( self
, url
):
61 display_id
= self
._ match
_ id
( url
)
62 info
= self
._ download
_ json
( url
+ '?flat=1' , display_id
)
64 video_title
= info
. get ( 'playlist_title' ) or info
. get ( 'video_title' )
67 'id' : compat_str ( video_info
[ 'id' ]),
68 'formats' : self
._ extract
_ m
3u8_ formats
(
69 video_info
[ 'src' ], display_id
, 'mp4' , 'm3u8_native' , m3u8_id
= 'hls' ,
70 note
= 'Download m3u8 information for video %d ' % ( idx
+ 1 )),
71 'title' : video_info
[ 'title' ],
72 'description' : video_info
. get ( 'description' ),
73 'duration' : parse_duration ( video_info
. get ( 'video_length' )),
74 'webpage_url' : video_info
. get ( 'href' ) or video_info
. get ( 'url' ),
75 'thumbnail' : video_info
. get ( 'thumbnailURL' ),
76 'alt_title' : video_info
. get ( 'secondary_title' ),
77 'timestamp' : parse_iso8601 ( video_info
. get ( 'publishedDate' )),
78 } for idx
, video_info
in enumerate ( info
[ 'playlist' ])]
80 return self
. playlist_result ( entries
, display_id
, video_title
)