]>
Raphaƫl G. Git Repositories - youtubedl/blob - youtube_dl/extractor/byutv.py
1 from __future__
import unicode_literals
5 from .common
import InfoExtractor
6 from ..utils
import ExtractorError
9 class BYUtvIE(InfoExtractor
):
10 _VALID_URL
= r
'https?://(?:www\.)?byutv\.org/watch/(?!event/)(?P<id>[0-9a-f-]+)(?:/(?P<display_id>[^/?#&]+))?'
12 'url': 'http://www.byutv.org/watch/6587b9a3-89d2-42a6-a7f7-fd2f81840a7d/studio-c-season-5-episode-5',
14 'id': '6587b9a3-89d2-42a6-a7f7-fd2f81840a7d',
15 'display_id': 'studio-c-season-5-episode-5',
17 'title': 'Season 5 Episode 5',
18 'description': 'md5:e07269172baff037f8e8bf9956bc9747',
19 'thumbnail': r
're:^https?://.*\.jpg$',
23 'skip_download': True,
27 'url': 'http://www.byutv.org/watch/6587b9a3-89d2-42a6-a7f7-fd2f81840a7d',
28 'only_matching': True,
31 def _real_extract(self
, url
):
32 mobj
= re
.match(self
._VALID
_URL
, url
)
33 video_id
= mobj
.group('id')
34 display_id
= mobj
.group('display_id') or video_id
36 webpage
= self
._download
_webpage
(url
, display_id
)
37 episode_code
= self
._search
_regex
(
38 r
'(?s)episode:(.*?\}),\s*\n', webpage
, 'episode information')
40 ep
= self
._parse
_json
(
41 episode_code
, display_id
, transform_source
=lambda s
:
42 re
.sub(r
'(\n\s+)([a-zA-Z]+):\s+\'(.*?
)\'', r'\
1"\2": "\3"', s))
44 if ep['providerType
'] != 'Ooyala
':
45 raise ExtractorError('Unsupported provider
%s' % ep['provider
'])
48 '_type
': 'url_transparent
',
50 'url
': 'ooyala
:%s' % ep['providerId
'],
52 'display_id
': display_id,
54 'description
': ep.get('description
'),
55 'thumbnail
': ep.get('imageThumbnail
'),
59 class BYUtvEventIE(InfoExtractor):
60 _VALID_URL = r'https?
://(?
:www\
.)?byutv\
.org
/watch
/event
/(?P
<id>[0-9a
-f
-]+)'
62 'url
': 'http
://www
.byutv
.org
/watch
/event
/29941b9b
-8bf6
-48d2
-aebf
-7a87add9e34b
',
64 'id': '29941b9b
-8bf6
-48d2
-aebf
-7a87add9e34b
',
66 'title
': 'Toledo vs
. BYU (9/30/16)',
69 'skip_download
': True,
74 def _real_extract(self, url):
75 video_id = self._match_id(url)
77 webpage = self._download_webpage(url, video_id)
79 ooyala_id = self._search_regex(
80 r'providerId\s
*:\s
*(["\'])(?P<id>(?:(?!\1).)+)\1',
81 webpage, 'ooyala id', group='id')
83 title = self._search_regex(
84 r'class=["\']description
["\'][^>]*>\s*<h1>([^<]+)</h1>', webpage,
88 '_type': 'url_transparent',
90 'url': 'ooyala:%s' % ooyala_id,