]>
Raphaƫl G. Git Repositories - youtubedl/blob - youtube_dl/extractor/amcnetworks.py
dd3b18d72d05f3deaab902b75cb6064e4b9d16ac
2 from __future__
import unicode_literals
4 from . theplatform
import ThePlatformIE
13 class AMCNetworksIE ( ThePlatformIE
):
14 _VALID_URL
= r
'https?://(?:www\.)?(?:amc|bbcamerica|ifc|wetv)\.com/(?:movies|shows(?:/[^/]+)+)/(?P<id>[^/?#]+)'
16 'url' : 'http://www.ifc.com/shows/maron/season-04/episode-01/step-1' ,
21 'title' : 'Maron - Season 4 - Step 1' ,
22 'description' : 'In denial about his current situation, Marc is reluctantly convinced by his friends to enter rehab. Starring Marc Maron and Constance Zimmer.' ,
24 'upload_date' : '20160505' ,
25 'timestamp' : 1462468831 ,
30 'skip_download' : True ,
32 'skip' : 'Requires TV provider accounts' ,
34 'url' : 'http://www.bbcamerica.com/shows/the-hunt/full-episodes/season-1/episode-01-the-hardest-challenge' ,
35 'only_matching' : True ,
37 'url' : 'http://www.amc.com/shows/preacher/full-episodes/season-01/episode-00/pilot' ,
38 'only_matching' : True ,
40 'url' : 'http://www.wetv.com/shows/million-dollar-matchmaker/season-01/episode-06-the-dumped-dj-and-shallow-hal' ,
41 'only_matching' : True ,
43 'url' : 'http://www.ifc.com/movies/chaos' ,
44 'only_matching' : True ,
46 'url' : 'http://www.bbcamerica.com/shows/doctor-who/full-episodes/the-power-of-the-daleks/episode-01-episode-1-color-version' ,
47 'only_matching' : True ,
49 'url' : 'http://www.wetv.com/shows/mama-june-from-not-to-hot/full-episode/season-01/thin-tervention' ,
50 'only_matching' : True ,
52 'url' : 'http://www.wetv.com/shows/la-hair/videos/season-05/episode-09-episode-9-2/episode-9-sneak-peek-3' ,
53 'only_matching' : True ,
56 def _real_extract ( self
, url
):
57 display_id
= self
._ match
_ id
( url
)
58 webpage
= self
._ download
_ webpage
( url
, display_id
)
63 media_url
= self
._ search
_ regex
(
64 r
'window\.platformLinkURL\s*=\s*[\' "]([^ \' " ]+) ',
66 theplatform_metadata = self._download_theplatform_metadata(self._search_regex(
67 r' link\
. theplatform\
. com
/ s
/([ ^?
]+) ',
68 media_url, ' theplatform_path
'), display_id)
69 info = self._parse_theplatform_metadata(theplatform_metadata)
70 video_id = theplatform_metadata[' pid
']
71 title = theplatform_metadata[' title
']
73 theplatform_metadata, lambda x: x[' ratings
'][0][' rating
'])
74 auth_required = self._search_regex(
75 r' window\
. authRequired\s
*= \s
*( true|false
); ',
76 webpage, ' auth required
')
77 if auth_required == ' true
':
78 requestor_id = self._search_regex(
79 r' window\
. requestor_id\s
*= \s
*[ \' "]([^ \' " ]+) ',
80 webpage, ' requestor
id ')
81 resource = self._get_mvpd_resource(
82 requestor_id, title, video_id, rating)
83 query[' auth
'] = self._extract_mvpd_auth(
84 url, video_id, requestor_id, resource)
85 media_url = update_url_query(media_url, query)
86 formats, subtitles = self._extract_theplatform_smil(
88 self._sort_formats(formats)
91 ' subtitles
': subtitles,
93 ' age_limit
': parse_age_limit(parse_age_limit(rating)),
95 ns_keys = theplatform_metadata.get(' $xmlns
', {}).keys()
98 series = theplatform_metadata.get(ns + ' $show
')
99 season_number = int_or_none(
100 theplatform_metadata.get(ns + ' $season
'))
101 episode = theplatform_metadata.get(ns + ' $episodeTitle
')
102 episode_number = int_or_none(
103 theplatform_metadata.get(ns + ' $episode
'))
105 title = ' Season
%d - %s ' % (season_number, title)
107 title = ' %s - %s ' % (series, title)
111 ' season_number
': season_number,
113 ' episode_number
': episode_number,