1
0
mirror of https://codeberg.org/polarisfm/youtube-dl synced 2024-11-23 00:54:31 +01:00

[teletask] Updated valid_url and media regex

This commit is contained in:
Lame Lemon 2019-10-10 09:32:53 +01:00
parent 07b50f616e
commit 58e96e434e

View File

@ -1,13 +1,11 @@
from __future__ import unicode_literals from __future__ import unicode_literals
import re
from .common import InfoExtractor from .common import InfoExtractor
from ..utils import unified_strdate from ..utils import unified_strdate
class TeleTaskIE(InfoExtractor): class TeleTaskIE(InfoExtractor):
_VALID_URL = r'https?://(?:www\.)?tele-task\.de/archive/video/html5/(?P<id>[0-9]+)' _VALID_URL = r'https?://(?:www\.)?tele-task\.de/(archive|lecture)/video/(html5/)?(?P<id>[0-9]+)'
_TEST = { _TEST = {
'url': 'http://www.tele-task.de/archive/video/html5/26168/', 'url': 'http://www.tele-task.de/archive/video/html5/26168/',
'info_dict': { 'info_dict': {
@ -15,7 +13,7 @@ class TeleTaskIE(InfoExtractor):
'title': 'Duplicate Detection', 'title': 'Duplicate Detection',
}, },
'playlist': [{ 'playlist': [{
'md5': '290ef69fb2792e481169c3958dbfbd57', 'md5': 'bc7b130ebb52acca59dfb7d96570dee3',
'info_dict': { 'info_dict': {
'id': '26168-speaker', 'id': '26168-speaker',
'ext': 'mp4', 'ext': 'mp4',
@ -23,7 +21,7 @@ class TeleTaskIE(InfoExtractor):
'upload_date': '20141218', 'upload_date': '20141218',
} }
}, { }, {
'md5': 'e1e7218c5f0e4790015a437fcf6c71b4', 'md5': '22a2da392d2e6a257230cf578df4aed4',
'info_dict': { 'info_dict': {
'id': '26168-slides', 'id': '26168-slides',
'ext': 'mp4', 'ext': 'mp4',
@ -38,16 +36,32 @@ class TeleTaskIE(InfoExtractor):
webpage = self._download_webpage(url, lecture_id) webpage = self._download_webpage(url, lecture_id)
title = self._html_search_regex( title = self._html_search_regex(
r'itemprop="name">([^<]+)</a>', webpage, 'title') r'<title>([^<]+)</title>', webpage, 'title')
upload_date = unified_strdate(self._html_search_regex( upload_date = unified_strdate(self._html_search_regex(
r'Date:</td><td>([^<]+)</td>', webpage, 'date', fatal=False)) r'Date:</td><td>([^<]+)</td>', webpage, 'date', fatal=False))
entries = [{ video_url = self._html_search_regex(r'(https(?:(?!https).)*?(?:hls/video\.m3u8))', webpage, 'video_url')
'id': '%s-%s' % (lecture_id, format_id), 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),
'url': video_url, 'url': video_url,
'title': title, 'title': title,
'upload_date': upload_date, 'upload_date': upload_date,
} for format_id, video_url in re.findall( 'formats': video_formats
r'<video class="([^"]+)"[^>]*>\s*<source src="([^"]+)"', webpage)] })
entries.append({
'id': '%s-slides' % (lecture_id),
'url': desktop_url,
'title': title,
'upload_date': upload_date,
'formats': desktop_formats
})
return self.playlist_result(entries, lecture_id, title) return self.playlist_result(entries, lecture_id, title)