]>
jfr.im git - yt-dlp.git/blob - youtube_dl/extractor/comcarcoff.py
2 from __future__
import unicode_literals
4 from . common
import InfoExtractor
5 from .. compat
import compat_str
13 class ComCarCoffIE ( InfoExtractor
):
14 _VALID_URL
= r
'http://(?:www\.)?comediansincarsgettingcoffee\.com/(?P<id>[a-z0-9\-]*)'
16 'url' : 'http://comediansincarsgettingcoffee.com/miranda-sings-happy-thanksgiving-miranda/' ,
20 'upload_date' : '20141127' ,
21 'timestamp' : 1417107600 ,
23 'title' : 'Happy Thanksgiving Miranda' ,
24 'description' : 'Jerry Seinfeld and his special guest Miranda Sings cruise around town in search of coffee, complaining and apologizing along the way.' ,
27 'skip_download' : 'requires ffmpeg' ,
31 def _real_extract ( self
, url
):
32 display_id
= self
._ match
_ id
( url
)
34 display_id
= 'comediansincarsgettingcoffee.com'
35 webpage
= self
._ download
_ webpage
( url
, display_id
)
37 full_data
= self
._ parse
_ json
(
39 r
'window\.app\s*=\s*( {.+?} );\n' , webpage
, 'full data json' ),
40 display_id
)[ 'videoData' ]
42 display_id
= full_data
[ 'activeVideo' ][ 'video' ]
43 video_data
= full_data
. get ( 'videos' , {}). get ( display_id
) or full_data
[ 'singleshots' ][ display_id
]
44 video_id
= compat_str ( video_data
[ 'mediaId' ])
46 'url' : video_data
[ 'images' ][ 'thumb' ],
48 'url' : video_data
[ 'images' ][ 'poster' ],
51 timestamp
= int_or_none ( video_data
. get ( 'pubDateTime' )) or parse_iso8601 (
52 video_data
. get ( 'pubDate' ))
53 duration
= int_or_none ( video_data
. get ( 'durationSeconds' )) or parse_duration (
54 video_data
. get ( 'duration' ))
57 '_type' : 'url_transparent' ,
58 'url' : 'crackle: %s ' % video_id
,
60 'display_id' : display_id
,
61 'title' : video_data
[ 'title' ],
62 'description' : video_data
. get ( 'description' ),
63 'timestamp' : timestamp
,
65 'thumbnails' : thumbnails
,
66 'season_number' : int_or_none ( video_data
. get ( 'season' )),
67 'episode_number' : int_or_none ( video_data
. get ( 'episode' )),
68 'webpage_url' : 'http://comediansincarsgettingcoffee.com/ %s ' % ( video_data
. get ( 'urlSlug' , video_data
. get ( 'slug' ))),