]> Raphaël G. Git Repositories - youtubedl/blob - youtube_dl/extractor/eitb.py
debian/copyright: Fix lintian's dep5-copyright-license-name-not-unique.
[youtubedl] / youtube_dl / extractor / eitb.py
1 # encoding: utf-8
2 from __future__ import unicode_literals
3
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):
12 IE_NAME = 'eitb.tv'
13 _VALID_URL = r'https?://www\.eitb\.tv/(eu/bideoa|es/video)/[^/]+/(?P<playlist_id>\d+)/(?P<chapter_id>\d+)'
14
15 _TEST = {
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)',
23 # All videos from eitb has this description in the brightcove info
24 'description': '.',
25 'uploader': 'Euskal Telebista',
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:
35 raise ExtractorError('Could not extract the Brightcove url')
36 # The BrightcoveExperience object doesn't contain the video id, we set
37 # it manually
38 bc_url += '&%40videoPlayer={0}'.format(chapter_id)
39 return self.url_result(bc_url, BrightcoveIE.ie_key())