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