[ooyala] check manifest ext with determine_ext and update tests for related extractors
[youtube-dl] / youtube_dl / extractor / teachingchannel.py
1 from __future__ import unicode_literals
2
3 import re
4
5 from .common import InfoExtractor
6 from .ooyala import OoyalaIE
7
8
9 class TeachingChannelIE(InfoExtractor):
10     _VALID_URL = r'https?://www\.teachingchannel\.org/videos/(?P<title>.+)'
11
12     _TEST = {
13         'url': 'https://www.teachingchannel.org/videos/teacher-teaming-evolution',
14         'md5': '3d6361864d7cac20b57c8784da17166f',
15         'info_dict': {
16             'id': 'F3bnlzbToeI6pLEfRyrlfooIILUjz4nM',
17             'ext': 'mp4',
18             'title': 'A History of Teaming',
19             'description': 'md5:2a9033db8da81f2edffa4c99888140b3',
20             'duration': 422.255,
21         },
22         'add_ie': ['Ooyala'],
23     }
24
25     def _real_extract(self, url):
26         mobj = re.match(self._VALID_URL, url)
27         title = mobj.group('title')
28         webpage = self._download_webpage(url, title)
29         ooyala_code = self._search_regex(
30             r'data-embed-code=\'(.+?)\'', webpage, 'ooyala code')
31
32         return OoyalaIE._build_url_result(ooyala_code)