]>
Raphaƫl G. Git Repositories - youtubedl/blob - youtube_dl/extractor/scrippsnetworks.py
2 from __future__
import unicode_literals
4 from . adobepass
import AdobePassIE
12 class ScrippsNetworksWatchIE ( AdobePassIE
):
13 IE_NAME
= 'scrippsnetworks:watch'
14 _VALID_URL
= r
'https?://watch\.(?:hgtv|foodnetwork|travelchannel|diynetwork|cookingchanneltv)\.com/player\.[A-Z0-9]+\.html#(?P<id>\d+)'
16 'url' : 'http://watch.hgtv.com/player.HNT.html#0256538' ,
17 'md5' : '26545fd676d939954c6808274bdb905a' ,
21 'title' : 'Seeking a Wow House' ,
22 'description' : 'Buyers retiring in Palm Springs, California, want a modern house with major wow factor. They \' re also looking for a pool and a large, open floorplan with tall windows looking out at the views.' ,
24 'upload_date' : '20170207' ,
25 'timestamp' : 1486450493 ,
27 'skip' : 'requires TV provider authentication' ,
30 def _real_extract ( self
, url
):
31 video_id
= self
._ match
_ id
( url
)
32 webpage
= self
._ download
_ webpage
( url
, video_id
)
33 channel
= self
._ parse
_ json
( self
._ search
_ regex
(
34 r
'"channels"\s*:\s*(\[.+\])' ,
35 webpage
, 'channels' ), video_id
)[ 0 ]
36 video_data
= next ( v
for v
in channel
[ 'videos' ] if v
. get ( 'nlvid' ) == video_id
)
37 title
= video_data
[ 'title' ]
38 release_url
= video_data
[ 'releaseUrl' ]
39 if video_data
. get ( 'restricted' ):
40 requestor_id
= self
._ search
_ regex
(
41 r
'requestorId\s*=\s*"([^"]+)";' , webpage
, 'requestor id' )
42 resource
= self
._ get
_ mvpd
_ resource
(
43 requestor_id
, title
, video_id
,
44 video_data
. get ( 'ratings' , [{}])[ 0 ]. get ( 'rating' ))
45 auth
= self
._ extract
_ mvpd
_ auth
(
46 url
, video_id
, requestor_id
, resource
)
47 release_url
= update_url_query ( release_url
, { 'auth' : auth
})
50 '_type' : 'url_transparent' ,
53 'url' : smuggle_url ( release_url
, { 'force_smil_url' : True }),
54 'description' : video_data
. get ( 'description' ),
55 'thumbnail' : video_data
. get ( 'thumbnailUrl' ),
56 'series' : video_data
. get ( 'showTitle' ),
57 'season_number' : int_or_none ( video_data
. get ( 'season' )),
58 'episode_number' : int_or_none ( video_data
. get ( 'episodeNumber' )),
59 'ie_key' : 'ThePlatform' ,