]>
Raphaƫl G. Git Repositories - youtubedl/blob - youtube_dl/extractor/macgamestore.py
b818cf50c85c79865b5afc09090d6261e81d08c6
   1 from __future__ 
import unicode_literals
 
   5 from .common 
import InfoExtractor
 
   6 from ..utils 
import ExtractorError
 
   9 class MacGameStoreIE(InfoExtractor
): 
  10     IE_NAME 
= 'macgamestore' 
  11     IE_DESC 
= 'MacGameStore trailers' 
  12     _VALID_URL 
= r
'https?://www\.macgamestore\.com/mediaviewer\.php\?trailer=(?P<id>\d+)' 
  15         'url': 'http://www.macgamestore.com/mediaviewer.php?trailer=2450', 
  17         'md5': '8649b8ea684b6666b4c5be736ecddc61', 
  23     def _real_extract(self
, url
): 
  24         mobj 
= re
.match(self
._VALID
_URL
, url
) 
  25         video_id 
= mobj
.group('id') 
  27         webpage 
= self
._download
_webpage
(url
, video_id
, 'Downloading trailer page') 
  29         if re
.search(r
'>Missing Media<', webpage
) is not None: 
  30             raise ExtractorError('Trailer %s does not exist' % video_id
, expected
=True) 
  32         video_title 
= self
._html
_search
_regex
( 
  33             r
'<title>MacGameStore: (.*?) Trailer</title>', webpage
, 'title') 
  35         video_url 
= self
._html
_search
_regex
( 
  36             r
'(?s)<div\s+id="video-player".*?href="([^"]+)"\s*>',