1
0
mirror of https://codeberg.org/polarisfm/youtube-dl synced 2025-02-18 10:07:55 +01:00
youtube-dl/youtube_dl/extractor/teletask.py

68 lines
2.2 KiB
Python
Raw Normal View History

2014-12-21 11:01:28 +01:00
from __future__ import unicode_literals
2014-12-25 18:26:57 +01:00
2014-12-21 11:01:28 +01:00
from .common import InfoExtractor
2014-12-25 18:26:57 +01:00
from ..utils import unified_strdate
2014-12-21 11:01:28 +01:00
class TeleTaskIE(InfoExtractor):
_VALID_URL = r'https?://(?:www\.)?tele-task\.de/(archive|lecture)/video/(html5/)?(?P<id>[0-9]+)'
2014-12-21 11:01:28 +01:00
_TEST = {
2014-12-21 12:26:47 +01:00
'url': 'http://www.tele-task.de/archive/video/html5/26168/',
2014-12-21 11:01:28 +01:00
'info_dict': {
2015-02-01 15:25:33 +01:00
'id': '26168',
2014-12-21 11:01:28 +01:00
'title': 'Duplicate Detection',
2014-12-21 12:26:47 +01:00
},
'playlist': [{
'md5': 'bc7b130ebb52acca59dfb7d96570dee3',
2014-12-21 12:26:47 +01:00
'info_dict': {
2014-12-25 18:26:57 +01:00
'id': '26168-speaker',
'ext': 'mp4',
2014-12-21 12:26:47 +01:00
'title': 'Duplicate Detection',
'upload_date': '20141218',
}
2014-12-25 18:26:57 +01:00
}, {
'md5': '22a2da392d2e6a257230cf578df4aed4',
2014-12-21 12:26:47 +01:00
'info_dict': {
2014-12-25 18:26:57 +01:00
'id': '26168-slides',
'ext': 'mp4',
2014-12-21 12:26:47 +01:00
'title': 'Duplicate Detection',
'upload_date': '20141218',
}
}]
2014-12-21 11:01:28 +01:00
}
def _real_extract(self, url):
2014-12-21 12:26:47 +01:00
lecture_id = self._match_id(url)
webpage = self._download_webpage(url, lecture_id)
2014-12-21 11:01:28 +01:00
title = self._html_search_regex(
r'<title>([^<]+)</title>', webpage, 'title')
2014-12-25 18:26:57 +01:00
upload_date = unified_strdate(self._html_search_regex(
r'Date:</td><td>([^<]+)</td>', webpage, 'date', fatal=False))
2014-12-21 11:01:28 +01:00
video_url = self._html_search_regex(r'(https(?:(?!https).)*?(?:hls/video\.m3u8))', webpage, 'video_url')
video_formats = self._extract_m3u8_formats(
video_url, lecture_id, 'mp4', fatal=False)
desktop_url = video_url.replace('video', 'desktop')
desktop_formats = self._extract_m3u8_formats(desktop_url, lecture_id, 'mp4', fatal=False)
entries = []
entries.append({
'id': '%s-speaker' % (lecture_id),
2014-12-25 18:26:57 +01:00
'url': video_url,
2014-12-21 12:26:47 +01:00
'title': title,
2014-12-25 18:26:57 +01:00
'upload_date': upload_date,
'formats': video_formats
})
entries.append({
'id': '%s-slides' % (lecture_id),
'url': desktop_url,
'title': title,
'upload_date': upload_date,
'formats': desktop_formats
})
2014-12-21 11:01:28 +01:00
2014-12-25 18:26:57 +01:00
return self.playlist_result(entries, lecture_id, title)