]>
Commit | Line | Data |
---|---|---|
5d7b253e | 1 | # encoding: utf-8 |
c95eeb7b PH |
2 | from __future__ import unicode_literals |
3 | ||
5d7b253e JMF |
4 | import re |
5 | ||
6 | from .common import InfoExtractor | |
7 | from .brightcove import BrightcoveIE | |
8 | from ..utils import ExtractorError | |
9 | ||
10 | ||
11 | class EitbIE(InfoExtractor): | |
c95eeb7b | 12 | IE_NAME = 'eitb.tv' |
5d7b253e JMF |
13 | _VALID_URL = r'https?://www\.eitb\.tv/(eu/bideoa|es/video)/[^/]+/(?P<playlist_id>\d+)/(?P<chapter_id>\d+)' |
14 | ||
15 | _TEST = { | |
c95eeb7b PH |
16 | 'add_ie': ['Brightcove'], |
17 | 'url': 'http://www.eitb.tv/es/video/60-minutos-60-minutos-2013-2014/2677100210001/2743577154001/lasa-y-zabala-30-anos/', | |
18 | 'md5': 'edf4436247185adee3ea18ce64c47998', | |
19 | 'info_dict': { | |
20 | 'id': '2743577154001', | |
21 | 'ext': 'mp4', | |
22 | 'title': '60 minutos (Lasa y Zabala, 30 años)', | |
5d7b253e | 23 | # All videos from eitb has this description in the brightcove info |
c95eeb7b PH |
24 | 'description': '.', |
25 | 'uploader': 'Euskal Telebista', | |
5d7b253e JMF |
26 | }, |
27 | } | |
28 | ||
29 | def _real_extract(self, url): | |
30 | mobj = re.match(self._VALID_URL, url) | |
31 | chapter_id = mobj.group('chapter_id') | |
32 | webpage = self._download_webpage(url, chapter_id) | |
33 | bc_url = BrightcoveIE._extract_brightcove_url(webpage) | |
34 | if bc_url is None: | |
c95eeb7b | 35 | raise ExtractorError('Could not extract the Brightcove url') |
5d7b253e JMF |
36 | # The BrightcoveExperience object doesn't contain the video id, we set |
37 | # it manually | |
c2b6a482 | 38 | bc_url += '&%40videoPlayer={0}'.format(chapter_id) |
5d7b253e | 39 | return self.url_result(bc_url, BrightcoveIE.ie_key()) |