]>
Raphaƫl G. Git Repositories - youtubedl/blob - youtube_dl/extractor/sevenplus.py
   2 from __future__ 
import unicode_literals
 
   6 from .brightcove 
import BrightcoveNewIE
 
   7 from ..compat 
import compat_str
 
  14 class SevenPlusIE(BrightcoveNewIE
): 
  16     _VALID_URL 
= r
'https?://(?:www\.)?7plus\.com\.au/(?P<path>[^?]+\?.*?\bepisode-id=(?P<id>[^&#]+))' 
  18         'url': 'https://7plus.com.au/MTYS?episode-id=MTYS7-003', 
  22             'title': 'S7 E3 - Wind Surf', 
  23             'description': 'md5:29c6a69f21accda7601278f81b46483d', 
  24             'uploader_id': '5303576322001', 
  25             'upload_date': '20171201', 
  26             'timestamp': 1512106377, 
  27             'series': 'Mighty Ships', 
  30             'episode': 'Wind Surf', 
  33             'format': 'bestvideo', 
  34             'skip_download': True, 
  37         'url': 'https://7plus.com.au/UUUU?episode-id=AUMS43-001', 
  38         'only_matching': True, 
  41     def _real_extract(self
, url
): 
  42         path
, episode_id 
= re
.match(self
._VALID
_URL
, url
).groups() 
  44         media 
= self
._download
_json
( 
  45             'https://videoservice.swm.digital/playback', episode_id
, query
={ 
  48                 'platformType': 'web', 
  49                 'accountId': 5303576322001, 
  50                 'referenceId': 'ref:' + episode_id
, 
  55         for source 
in media
.get('sources', {}): 
  56             src 
= source
.get('src') 
  59             source
['src'] = update_url_query(src
, {'rule': ''}) 
  61         info 
= self
._parse
_brightcove
_metadata
(media
, episode_id
) 
  63         content 
= self
._download
_json
( 
  64             'https://component-cdn.swm.digital/content/' + path
, 
  68         for item 
in content
.get('items', {}): 
  69             if item
.get('componentData', {}).get('componentType') == 'infoPanel': 
  70                 for src_key
, dst_key 
in [('title', 'title'), ('shortSynopsis', 'description')]: 
  71                     value 
= item
.get(src_key
) 
  74                 info
['series'] = try_get( 
  75                     item
, lambda x
: x
['seriesLogo']['name'], compat_str
) 
  76                 mobj 
= re
.search(r
'^S(\d+)\s+E(\d+)\s+-\s+(.+)$', info
['title']) 
  79                         'season_number': int(mobj
.group(1)), 
  80                         'episode_number': int(mobj
.group(2)), 
  81                         'episode': mobj
.group(3),