]>
Raphaƫl G. Git Repositories - youtubedl/blob - youtube_dl/extractor/plays.py
   2 from __future__ 
import unicode_literals
 
   6 from .common 
import InfoExtractor
 
   7 from ..utils 
import int_or_none
 
  10 class PlaysTVIE(InfoExtractor
): 
  11     _VALID_URL 
= r
'https?://(?:www\.)?plays\.tv/(?:video|embeds)/(?P<id>[0-9a-f]{18})' 
  13         'url': 'https://plays.tv/video/56af17f56c95335490/when-you-outplay-the-azir-wall', 
  14         'md5': 'dfeac1198506652b5257a62762cec7bc', 
  16             'id': '56af17f56c95335490', 
  18             'title': 'Bjergsen - When you outplay the Azir wall', 
  19             'description': 'Posted by Bjergsen', 
  22         'url': 'https://plays.tv/embeds/56af17f56c95335490', 
  23         'only_matching': True, 
  26     def _real_extract(self
, url
): 
  27         video_id 
= self
._match
_id
(url
) 
  28         webpage 
= self
._download
_webpage
( 
  29             'https://plays.tv/video/%s' % video_id
, video_id
) 
  31         info 
= self
._search
_json
_ld
(webpage
, video_id
,) 
  33         mpd_url
, sources 
= re
.search( 
  34             r
'(?s)<video[^>]+data-mpd="([^"]+)"[^>]*>(.+?)</video>', 
  36         formats 
= self
._extract
_mpd
_formats
( 
  37             self
._proto
_relative
_url
(mpd_url
), video_id
, mpd_id
='DASH') 
  38         for format_id
, height
, format_url 
in re
.findall(r
'<source\s+res="((\d+)h?)"\s+src="([^"]+)"', sources
): 
  40                 'url': self
._proto
_relative
_url
(format_url
), 
  41                 'format_id': 'http-' + format_id
, 
  42                 'height': int_or_none(height
), 
  44         self
._sort
_formats
(formats
) 
  48             'description': self
._og
_search
_description
(webpage
), 
  49             'thumbnail': info
.get('thumbnail') or self
._og
_search
_thumbnail
(webpage
),