Correct which fields are fail inducing and crash proof

This commit is contained in:
nomevi 2022-07-10 01:45:51 +02:00
parent 26dc85adb4
commit ea4a9f4d98

View File

@ -4,6 +4,11 @@ from __future__ import unicode_literals
from .common import InfoExtractor from .common import InfoExtractor
import time import time
import calendar import calendar
from ..utils import (
try_get,
url_or_none,
)
from ..compat import compat_str
class LivestreamfailsIE(InfoExtractor): class LivestreamfailsIE(InfoExtractor):
@ -40,10 +45,10 @@ class LivestreamfailsIE(InfoExtractor):
return { return {
'id': id, 'id': id,
'url': 'https://livestreamfails-video-prod.b-cdn.net/video/' + api_response['videoId'],
'title': api_response['label'],
'display_id': api_response.get('sourceId'), # Twitch ID of clip 'display_id': api_response.get('sourceId'), # Twitch ID of clip
'timestamp': timestamp, 'timestamp': timestamp,
'url': 'https://livestreamfails-video-prod.b-cdn.net/video/' + api_response.get('videoId'), 'creator': try_get(api_response, lambda x: x['streamer']['label'], compat_str),
'title': api_response.get('label'), 'thumbnail': url_or_none(try_get(api_response, lambda x: 'https://livestreamfails-image-prod.b-cdn.net/image/' + x['imageId']))
'creator': api_response.get('streamer', {}).get('label'),
'thumbnail': 'https://livestreamfails-image-prod.b-cdn.net/image/' + api_response.get('imageId'),
} }