]>
Raphaƫl G. Git Repositories - youtubedl/blob - youtube_dl/extractor/amcnetworks.py
c739d2c99167dbd27e44dee326fcb49222029187
2 from __future__
import unicode_literals
4 from . theplatform
import ThePlatformIE
12 class AMCNetworksIE ( ThePlatformIE
):
13 _VALID_URL
= r
'https?://(?:www\.)?(?:amc|bbcamerica|ifc|wetv)\.com/(?:movies/|shows/[^/]+/(?:full-episodes/)?season-\d+/episode-\d+(?:-(?:[^/]+/)?|/))(?P<id>[^/?#]+)'
15 'url' : 'http://www.ifc.com/shows/maron/season-04/episode-01/step-1' ,
20 'title' : 'Maron - Season 4 - Step 1' ,
21 'description' : 'In denial about his current situation, Marc is reluctantly convinced by his friends to enter rehab. Starring Marc Maron and Constance Zimmer.' ,
23 'upload_date' : '20160505' ,
24 'timestamp' : 1462468831 ,
29 'skip_download' : True ,
32 'url' : 'http://www.bbcamerica.com/shows/the-hunt/full-episodes/season-1/episode-01-the-hardest-challenge' ,
33 'only_matching' : True ,
35 'url' : 'http://www.amc.com/shows/preacher/full-episodes/season-01/episode-00/pilot' ,
36 'only_matching' : True ,
38 'url' : 'http://www.wetv.com/shows/million-dollar-matchmaker/season-01/episode-06-the-dumped-dj-and-shallow-hal' ,
39 'only_matching' : True ,
41 'url' : 'http://www.ifc.com/movies/chaos' ,
42 'only_matching' : True ,
45 def _real_extract ( self
, url
):
46 display_id
= self
._ match
_ id
( url
)
47 webpage
= self
._ download
_ webpage
( url
, display_id
)
52 media_url
= self
._ search
_ regex
( r
'window\.platformLinkURL\s*=\s*[\' "]([^ \' " ]+) ', webpage, ' media url
')
53 theplatform_metadata = self._download_theplatform_metadata(self._search_regex(
54 r' https?
:// link
. theplatform
. com
/ s
/([ ^?
]+) ', media_url, ' theplatform_path
'), display_id)
55 info = self._parse_theplatform_metadata(theplatform_metadata)
56 video_id = theplatform_metadata[' pid
']
57 title = theplatform_metadata[' title
']
58 rating = theplatform_metadata[' ratings
'][0][' rating
']
59 auth_required = self._search_regex(r' window\
. authRequired\s
*= \s
*( true|false
); ', webpage, ' auth required
')
60 if auth_required == ' true
':
61 requestor_id = self._search_regex(r' window\
. requestor_id\s
*= \s
*[ \' "]([^ \' " ]+) ', webpage, ' requestor
id ')
62 resource = self._get_mvpd_resource(requestor_id, title, video_id, rating)
63 query[' auth
'] = self._extract_mvpd_auth(url, video_id, requestor_id, resource)
64 media_url = update_url_query(media_url, query)
65 formats, subtitles = self._extract_theplatform_smil(media_url, video_id)
66 self._sort_formats(formats)
69 ' subtitles
': subtitles,
71 ' age_limit
': parse_age_limit(parse_age_limit(rating)),
73 ns_keys = theplatform_metadata.get(' $xmlns
', {}).keys()
76 series = theplatform_metadata.get(ns + ' $show
')
77 season_number = int_or_none(theplatform_metadata.get(ns + ' $season
'))
78 episode = theplatform_metadata.get(ns + ' $episodeTitle
')
79 episode_number = int_or_none(theplatform_metadata.get(ns + ' $episode
'))
81 title = ' Season
%d - %s ' % (season_number, title)
83 title = ' %s - %s ' % (series, title)
87 ' season_number
': season_number,
89 ' episode_number
': episode_number,