]>
Raphaƫl G. Git Repositories - youtubedl/blob - youtube_dl/extractor/wakanim.py
   2 from __future__ 
import unicode_literals
 
   4 from .common 
import InfoExtractor
 
  12 class WakanimIE(InfoExtractor
): 
  13     _VALID_URL 
= r
'https://(?:www\.)?wakanim\.tv/[^/]+/v2/catalogue/episode/(?P<id>\d+)' 
  15         'url': 'https://www.wakanim.tv/de/v2/catalogue/episode/2997/the-asterisk-war-omu-staffel-1-episode-02-omu', 
  19             'title': 'Episode 02', 
  20             'description': 'md5:2927701ea2f7e901de8bfa8d39b2852d', 
  21             'series': 'The Asterisk War  (OmU.)', 
  23             'episode': 'Episode 02', 
  27             'format': 'bestvideo', 
  28             'skip_download': True, 
  32         'url': 'https://www.wakanim.tv/de/v2/catalogue/episode/7843/sword-art-online-alicization-omu-arc-2-folge-15-omu', 
  33         'only_matching': True, 
  36     def _real_extract(self
, url
): 
  37         video_id 
= self
._match
_id
(url
) 
  39         webpage 
= self
._download
_webpage
(url
, video_id
) 
  41         m3u8_url 
= urljoin(url
, self
._search
_regex
( 
  42             r
'file\s*:\s*(["\'])(?P
<url
>(?
:(?
!\
1).)+)\
1', webpage, 'm3u8 url
', 
  44         # https://docs.microsoft.com/en-us/azure/media-services/previous/media-services-content-protection-overview#streaming-urls 
  45         encryption = self._search_regex( 
  46             r'encryption
%3D(c(?
:enc|
bc(?
:s
-aapl
)?
))', 
  47             m3u8_url, 'encryption
', default=None) 
  48         if encryption and encryption in ('cenc
', 'cbcs
-aapl
'): 
  49             raise ExtractorError('This video 
is DRM protected
.', expected=True) 
  51         formats = self._extract_m3u8_formats( 
  52             m3u8_url, video_id, 'mp4
', entry_protocol='m3u8_native
', 
  55         info = self._search_json_ld(webpage, video_id, default={}) 
  57         title = self._search_regex( 
  58             (r'<h1
[^
>]+\bclass
=["\']episode_h1[^>]+\btitle=(["\'])(?P
<title
>(?
:(?
!\
1).)+)\
1', 
  59              r'<span
[^
>]+\bclass
=["\']episode_title["\'][^
>]*>(?P
<title
>[^
<]+)'), 
  60             webpage, 'title
', default=None, group='title
') 
  62         return merge_dicts(info, {