]>
 
 
Raphaƫl G. Git Repositories - youtubedl/blob - youtube_dl/extractor/amcnetworks.py 
 
 
 
 
 
 
 
 
   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(?:/[^/]+)+)/(?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 ,  
  31          'skip' :  'Requires TV provider accounts' ,  
  33          'url' :  'http://www.bbcamerica.com/shows/the-hunt/full-episodes/season-1/episode-01-the-hardest-challenge' ,  
  34          'only_matching' :  True ,  
  36          'url' :  'http://www.amc.com/shows/preacher/full-episodes/season-01/episode-00/pilot' ,  
  37          'only_matching' :  True ,  
  39          'url' :  'http://www.wetv.com/shows/million-dollar-matchmaker/season-01/episode-06-the-dumped-dj-and-shallow-hal' ,  
  40          'only_matching' :  True ,  
  42          'url' :  'http://www.ifc.com/movies/chaos' ,  
  43          'only_matching' :  True ,  
  45          'url' :  'http://www.bbcamerica.com/shows/doctor-who/full-episodes/the-power-of-the-daleks/episode-01-episode-1-color-version' ,  
  46          'only_matching' :  True ,  
  48          'url' :  'http://www.wetv.com/shows/mama-june-from-not-to-hot/full-episode/season-01/thin-tervention' ,  
  49          'only_matching' :  True ,  
  51          'url' :  'http://www.wetv.com/shows/la-hair/videos/season-05/episode-09-episode-9-2/episode-9-sneak-peek-3' ,  
  52          'only_matching' :  True ,  
  55      def  _real_extract ( self
,  url
):  
  56          display_id 
=  self
._ match
_ id
( url
)  
  57          webpage 
=  self
._ download
_ webpage
( url
,  display_id
)  
  62          media_url 
=  self
._ search
_ regex
(  
  63              r
'window\.platformLinkURL\s*=\s*[\' "]([^ \' " ]+) ',  
  65          theplatform_metadata = self._download_theplatform_metadata(self._search_regex(  
  66              r' link\
. theplatform\
. com
/ s
/([ ^?
]+) ',  
  67              media_url, ' theplatform_path
'), display_id)  
  68          info = self._parse_theplatform_metadata(theplatform_metadata)  
  69          video_id = theplatform_metadata[' pid
']  
  70          title = theplatform_metadata[' title
']  
  71          rating = theplatform_metadata[' ratings
'][0][' rating
']  
  72          auth_required = self._search_regex(  
  73              r' window\
. authRequired\s
*= \s
*( true|false
); ',  
  74              webpage, ' auth required
')  
  75          if auth_required == ' true
':  
  76              requestor_id = self._search_regex(  
  77                  r' window\
. requestor_id\s
*= \s
*[ \' "]([^ \' " ]+) ',  
  78                  webpage, ' requestor 
id ')  
  79              resource = self._get_mvpd_resource(  
  80                  requestor_id, title, video_id, rating)  
  81              query[' auth
'] = self._extract_mvpd_auth(  
  82                  url, video_id, requestor_id, resource)  
  83          media_url = update_url_query(media_url, query)  
  84          formats, subtitles = self._extract_theplatform_smil(  
  86          self._sort_formats(formats)  
  89              ' subtitles
': subtitles,  
  91              ' age_limit
': parse_age_limit(parse_age_limit(rating)),  
  93          ns_keys = theplatform_metadata.get(' $xmlns
', {}).keys()  
  96              series = theplatform_metadata.get(ns + ' $show
')  
  97              season_number = int_or_none(  
  98                  theplatform_metadata.get(ns + ' $season
'))  
  99              episode = theplatform_metadata.get(ns + ' $episodeTitle
')  
 100              episode_number = int_or_none(  
 101                  theplatform_metadata.get(ns + ' $episode
'))  
 103                  title = ' Season 
%d -  %s ' % (season_number, title)  
 105                  title = ' %s -  %s ' % (series, title)  
 109                  ' season_number
': season_number,  
 111                  ' episode_number
': episode_number,