1
0
mirror of https://codeberg.org/polarisfm/youtube-dl synced 2024-11-26 02:14:32 +01:00

Handling cases where the site removed a video but do not 404

This commit is contained in:
Frederic Bournival 2020-04-19 21:41:26 -04:00
parent 8f91c383bf
commit 5b8203f184

View File

@ -4,6 +4,7 @@ from __future__ import unicode_literals
from .common import InfoExtractor
from ..utils import (
ExtractorError,
get_element_by_id
)
@ -50,11 +51,15 @@ class TV5UnisCaIE(InfoExtractor):
get_element_by_id('__NEXT_DATA__', webpage), display_id) \
.get('props').get('apolloState')
info_dict = self._json_ld(
next_data_dict['$ArtisanBlocksPageMetaData:50.blockConfiguration.pageMetaDataConfiguration']['jsonLd'],
display_id
metadata = next_data_dict.get(
'$ArtisanBlocksPageMetaData:50.blockConfiguration.pageMetaDataConfiguration', None
)
if not metadata:
raise ExtractorError('Video removed or not found.', expected=True)
info_dict = self._json_ld(metadata.get('jsonLd'), display_id)
if info_dict.get('season', ''):
info_dict['title'] = ' - '.join((info_dict.get('season', ''), info_dict.get('episode', '')))