]> git.bitcoin.ninja Git - youtube-dl/blob - youtube_dl/extractor/teachingchannel.py
[twitch] add support for Clip embed URLs
[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         'params': {
23             'skip_download': True,
24         },
25         'add_ie': ['Ooyala'],
26     }
27
28     def _real_extract(self, url):
29         mobj = re.match(self._VALID_URL, url)
30         title = mobj.group('title')
31         webpage = self._download_webpage(url, title)
32         ooyala_code = self._search_regex(
33             r'data-embed-code=\'(.+?)\'', webpage, 'ooyala code')
34
35         return OoyalaIE._build_url_result(ooyala_code)