X-Git-Url: http://git.bitcoin.ninja/index.cgi?a=blobdiff_plain;f=youtube_dl%2Fextractor%2Fteletask.py;h=b9e2ef8cab9a0e3a63bf5a46baf2b70a39afa1cb;hb=HEAD;hp=1c42ac6f4abcd01f0d805522b4aa43e5ff82c9ba;hpb=ee45625290c678c53b7ee86d2adba40847b79573;p=youtube-dl diff --git a/youtube_dl/extractor/teletask.py b/youtube_dl/extractor/teletask.py index 1c42ac6f4..b9e2ef8ca 100644 --- a/youtube_dl/extractor/teletask.py +++ b/youtube_dl/extractor/teletask.py @@ -1,59 +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': 'TODO: md5 sum of the first 10241 bytes of the video file (use --test)', + 'url': 'http://www.tele-task.de/archive/video/html5/26168/', 'info_dict': { 'id': '26168', - 'ext': 'mp4', 'title': 'Duplicate Detection', - 'thumbnail': 're:^https?://.*\.jpg$', - 'date': '20141218', - # TODO more properties, either as: - # * A value - # * MD5 checksum; start the string with md5: - # * A regular expression; start the string with re: - # * Any Python type (for example int or float) - } + }, + '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_url = self._html_search_regex( - r'href="([^"]+)" itemprop="name">', webpage, 'title') - lecture_id = re.search("([0-9]+)/",lecture_url).group(1) - overview_page = self._download_webpage("http://www.tele-task.de" + lecture_url, - lecture_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) - description = self._html_search_regex( - r'Description of the series:

([^"]+)', overview_page, - 'description',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, - 'description': description, - 'url': url, - 'upload_date': date, - } \ No newline at end of file + 'upload_date': upload_date, + } for format_id, video_url in re.findall( + r'