]>
Raphaƫl G. Git Repositories - youtubedl/blob - youtube_dl/extractor/gamersyde.py
   1 from __future__ 
import unicode_literals
 
   5 from .common 
import InfoExtractor
 
  13 class GamersydeIE(InfoExtractor
): 
  14     _VALID_URL 
= r
'https?://(?:www\.)?gamersyde\.com/hqstream_(?P<display_id>[\da-z_]+)-(?P<id>\d+)_[a-z]{2}\.html' 
  16         'url': 'http://www.gamersyde.com/hqstream_bloodborne_birth_of_a_hero-34371_en.html', 
  17         'md5': 'f38d400d32f19724570040d5ce3a505f', 
  22             'title': 'Bloodborne - Birth of a hero', 
  23             'thumbnail': 're:^https?://.*\.jpg$', 
  27     def _real_extract(self
, url
): 
  28         mobj 
= re
.match(self
._VALID
_URL
, url
) 
  29         video_id 
= mobj
.group('id') 
  30         display_id 
= mobj
.group('display_id') 
  32         webpage 
= self
._download
_webpage
(url
, display_id
) 
  34         playlist 
= self
._parse
_json
( 
  36                 r
'(?s)playlist: \[({.+?})\]\s*}\);', webpage
, 'files'), 
  37             display_id
, transform_source
=js_to_json
) 
  40         for source 
in playlist
['sources']: 
  41             video_url 
= source
.get('file') 
  44             format_id 
= source
.get('label') 
  47                 'format_id': format_id
, 
  49             m 
= re
.search(r
'^(?P<height>\d+)[pP](?P<fps>\d+)fps', format_id
) 
  52                     'height': int(m
.group('height')), 
  53                     'fps': int(m
.group('fps')), 
  56         self
._sort
_formats
(formats
) 
  58         title 
= remove_start(playlist
['title'], '%s - ' % video_id
) 
  59         thumbnail 
= playlist
.get('image') 
  60         duration 
= parse_duration(self
._search
_regex
( 
  61             r
'Length:</label>([^<]+)<', webpage
, 'duration', fatal
=False)) 
  65             'display_id': display_id
, 
  67             'thumbnail': thumbnail
,