X-Git-Url: http://git.bitcoin.ninja/index.cgi?a=blobdiff_plain;f=youtube_dl%2Fextractor%2Fteletask.py;h=b9e2ef8cab9a0e3a63bf5a46baf2b70a39afa1cb;hb=HEAD;hp=6920b871e29ee5597f88c16088235c7bb57c0202;hpb=3f7421b71b0d7da917a92b6f37985bc26c5dc11d;p=youtube-dl diff --git a/youtube_dl/extractor/teletask.py b/youtube_dl/extractor/teletask.py index 6920b871e..b9e2ef8ca 100644 --- a/youtube_dl/extractor/teletask.py +++ b/youtube_dl/extractor/teletask.py @@ -1,43 +1,53 @@ -# coding: utf-8 from __future__ import unicode_literals -import re -import datetime +import re from .common import InfoExtractor +from ..utils import unified_strdate class TeleTaskIE(InfoExtractor): - _VALID_URL = r'http?://(?:www\.)?tele-task\.de/archive/video/html5/(?P[0-9]+)/' + _VALID_URL = r'https?://(?:www\.)?tele-task\.de/archive/video/html5/(?P[0-9]+)' _TEST = { - 'url': 'http://www.tele-task.de/archive/video/html5/26168/', - 'md5': '290ef69fb2792e481169c3958dbfbd57', + 'url': 'http://www.tele-task.de/archive/video/html5/26168/', 'info_dict': { 'id': '26168', - 'ext': 'mp4', 'title': 'Duplicate Detection', - 'upload_date': '20141218', - } + }, + 'playlist': [{ + 'md5': '290ef69fb2792e481169c3958dbfbd57', + 'info_dict': { + 'id': '26168-speaker', + 'ext': 'mp4', + 'title': 'Duplicate Detection', + 'upload_date': '20141218', + } + }, { + 'md5': 'e1e7218c5f0e4790015a437fcf6c71b4', + 'info_dict': { + 'id': '26168-slides', + 'ext': 'mp4', + 'title': 'Duplicate Detection', + 'upload_date': '20141218', + } + }] } def _real_extract(self, url): - video_id = self._match_id(url) - webpage = self._download_webpage(url, video_id) - + lecture_id = self._match_id(url) + webpage = self._download_webpage(url, lecture_id) + title = self._html_search_regex( - r'itemprop="name">([^"]+)', webpage, 'title') - url = self._html_search_regex( - r'class="speaker".*?src="([^"]+)"', webpage, 'video_url', flags=re.DOTALL) - - date = self._html_search_regex( - r'Date:([^"]+)', webpage, 'date') - date = datetime.datetime.strptime(date, '%d.%m.%Y').strftime('%Y%m%d') - - - - return { - 'id': video_id, + r'itemprop="name">([^<]+)', webpage, 'title') + upload_date = unified_strdate(self._html_search_regex( + r'Date:([^<]+)', webpage, 'date', fatal=False)) + + entries = [{ + 'id': '%s-%s' % (lecture_id, format_id), + 'url': video_url, 'title': title, - 'url': url, - 'upload_date': date, - } \ No newline at end of file + 'upload_date': upload_date, + } for format_id, video_url in re.findall( + r'