0
0
Fork 0
mirror of https://github.com/yt-dlp/yt-dlp.git synced 2024-11-14 01:05:06 +00:00
yt-dlp/yt_dlp/extractor/tonline.py

54 lines
1.9 KiB
Python
Raw Normal View History

2016-10-04 06:59:53 +00:00
from .common import InfoExtractor
2021-11-06 01:05:24 +00:00
from ..utils import int_or_none, join_nonempty
2016-10-04 06:59:53 +00:00
class TOnlineIE(InfoExtractor):
_WORKING = False
_ENABLED = None # XXX: pass through to GenericIE
2016-10-04 06:59:53 +00:00
IE_NAME = 't-online.de'
_VALID_URL = r'https?://(?:www\.)?t-online\.de/tv/(?:[^/]+/)*id_(?P<id>\d+)'
_TEST = {
'url': 'http://www.t-online.de/tv/sport/fussball/id_79166266/drittes-remis-zidane-es-muss-etwas-passieren-.html',
'md5': '7d94dbdde5f9d77c5accc73c39632c29',
'info_dict': {
'id': '79166266',
'ext': 'mp4',
'title': 'Drittes Remis! Zidane: "Es muss etwas passieren"',
'description': 'Es läuft nicht rund bei Real Madrid. Das 1:1 gegen den SD Eibar war das dritte Unentschieden in Folge in der Liga.',
},
2016-10-04 06:59:53 +00:00
}
def _real_extract(self, url):
video_id = self._match_id(url)
video_data = self._download_json(
f'http://www.t-online.de/tv/id_{video_id}/tid_json_video', video_id)
2016-10-04 06:59:53 +00:00
title = video_data['subtitle']
formats = []
for asset in video_data.get('assets', []):
asset_source = asset.get('source') or asset.get('source2')
if not asset_source:
continue
formats.append({
2021-11-06 01:05:24 +00:00
'format_id': join_nonempty('type', 'profile', from_dict=asset),
2016-10-04 06:59:53 +00:00
'url': asset_source,
})
thumbnails = []
for image in video_data.get('images', []):
image_source = image.get('source')
if not image_source:
continue
thumbnails.append({
'url': image_source,
})
return {
'id': video_id,
'title': title,
'description': video_data.get('description'),
'duration': int_or_none(video_data.get('duration')),
'thumbnails': thumbnails,
'formats': formats,
}