]> Raphaƫl G. Git Repositories - youtubedl/blob - youtube_dl/extractor/teletask.py
Merge tag 'upstream/2015.06.04.1'
[youtubedl] / youtube_dl / extractor / teletask.py
1 from __future__ import unicode_literals
2
3 import re
4
5 from .common import InfoExtractor
6 from ..utils import unified_strdate
7
8
9 class TeleTaskIE(InfoExtractor):
10 _VALID_URL = r'https?://(?:www\.)?tele-task\.de/archive/video/html5/(?P<id>[0-9]+)'
11 _TEST = {
12 'url': 'http://www.tele-task.de/archive/video/html5/26168/',
13 'info_dict': {
14 'id': '26168',
15 'title': 'Duplicate Detection',
16 },
17 'playlist': [{
18 'md5': '290ef69fb2792e481169c3958dbfbd57',
19 'info_dict': {
20 'id': '26168-speaker',
21 'ext': 'mp4',
22 'title': 'Duplicate Detection',
23 'upload_date': '20141218',
24 }
25 }, {
26 'md5': 'e1e7218c5f0e4790015a437fcf6c71b4',
27 'info_dict': {
28 'id': '26168-slides',
29 'ext': 'mp4',
30 'title': 'Duplicate Detection',
31 'upload_date': '20141218',
32 }
33 }]
34 }
35
36 def _real_extract(self, url):
37 lecture_id = self._match_id(url)
38 webpage = self._download_webpage(url, lecture_id)
39
40 title = self._html_search_regex(
41 r'itemprop="name">([^<]+)</a>', webpage, 'title')
42 upload_date = unified_strdate(self._html_search_regex(
43 r'Date:</td><td>([^<]+)</td>', webpage, 'date', fatal=False))
44
45 entries = [{
46 'id': '%s-%s' % (lecture_id, format_id),
47 'url': video_url,
48 'title': title,
49 'upload_date': upload_date,
50 } for format_id, video_url in re.findall(
51 r'<video class="([^"]+)"[^>]*>\s*<source src="([^"]+)"', webpage)]
52
53 return self.playlist_result(entries, lecture_id, title)