[youtube] Fix extraction.
[youtube-dl] / youtube_dl / extractor / teachingchannel.py
1 from __future__ import unicode_literals
2
3 from .common import InfoExtractor
4
5
6 class TeachingChannelIE(InfoExtractor):
7     _VALID_URL = r'https?://(?:www\.)?teachingchannel\.org/videos?/(?P<id>[^/?&#]+)'
8
9     _TEST = {
10         'url': 'https://www.teachingchannel.org/videos/teacher-teaming-evolution',
11         'info_dict': {
12             'id': '3swwlzkT',
13             'ext': 'mp4',
14             'title': 'A History of Teaming',
15             'description': 'md5:2a9033db8da81f2edffa4c99888140b3',
16             'duration': 422,
17             'upload_date': '20170316',
18             'timestamp': 1489691297,
19         },
20         'params': {
21             'skip_download': True,
22         },
23         'add_ie': ['JWPlatform'],
24     }
25
26     def _real_extract(self, url):
27         display_id = self._match_id(url)
28         webpage = self._download_webpage(url, display_id)
29         mid = self._search_regex(
30             r'(?:data-mid=["\']|id=["\']jw-video-player-)([a-zA-Z0-9]{8})',
31             webpage, 'media id')
32
33         return self.url_result('jwplatform:' + mid, 'JWPlatform', mid)