]>
Raphaƫl G. Git Repositories - youtubedl/blob - youtube_dl/extractor/byutv.py
   1 from __future__ 
import unicode_literals
 
   6 from .common 
import InfoExtractor
 
   7 from ..utils 
import ExtractorError
 
  10 class BYUtvIE(InfoExtractor
): 
  11     _VALID_URL 
= r
'^https?://(?:www\.)?byutv.org/watch/[0-9a-f-]+/(?P<video_id>[^/?#]+)' 
  13         'url': 'http://www.byutv.org/watch/44e80f7b-e3ba-43ba-8c51-b1fd96c94a79/granite-flats-talking', 
  15             'id': 'granite-flats-talking', 
  17             'description': 'md5:4e9a7ce60f209a33eca0ac65b4918e1c', 
  19             'thumbnail': 're:^https?://.*promo.*' 
  22             'skip_download': True, 
  26     def _real_extract(self
, url
): 
  27         mobj 
= re
.match(self
._VALID
_URL
, url
) 
  28         video_id 
= mobj
.group('video_id') 
  30         webpage 
= self
._download
_webpage
(url
, video_id
) 
  31         episode_code 
= self
._search
_regex
( 
  32             r
'(?s)episode:(.*?\}),\s*\n', webpage
, 'episode information') 
  33         episode_json 
= re
.sub( 
  34             r
'(\n\s+)([a-zA-Z]+):\s+\'(.*?
)\'', r'\
1"\2": "\3"', episode_code) 
  35         ep = json.loads(episode_json) 
  37         if ep['providerType
'] == 'Ooyala
': 
  39                 '_type
': 'url_transparent
', 
  41                 'url
': 'ooyala
:%s' % ep['providerId
'], 
  44                 'description
': ep.get('description
'), 
  45                 'thumbnail
': ep.get('imageThumbnail
'), 
  48             raise ExtractorError('Unsupported provider 
%s' % ep['provider
'])