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

[itv] Make SOAP request non fatal and extract metadata from a webpage (closes #16780)

This commit is contained in:
Sergey M․ 2018-06-21 23:06:58 +07:00
parent 91aa502d91
commit 30374f4d40
No known key found for this signature in database
GPG Key ID: 2C393E0F18A9236D

View File

@ -18,6 +18,7 @@ from ..utils import (
xpath_element,
xpath_text,
int_or_none,
merge_dicts,
parse_duration,
smuggle_url,
ExtractorError,
@ -129,7 +130,8 @@ class ITVIE(InfoExtractor):
resp_env = self._download_xml(
params['data-playlist-url'], video_id,
headers=headers, data=etree.tostring(req_env))
headers=headers, data=etree.tostring(req_env), fatal=False)
if resp_env:
playlist = xpath_element(resp_env, './/Playlist')
if playlist is None:
fault_code = xpath_text(resp_env, './/faultcode')
@ -261,7 +263,17 @@ class ITVIE(InfoExtractor):
'formats': formats,
'subtitles': subtitles,
})
return info
webpage_info = self._search_json_ld(webpage, video_id, default={})
if not webpage_info.get('title'):
webpage_info['title'] = self._html_search_regex(
r'(?s)<h\d+[^>]+\bclass=["\'][^>]*episode-title["\'][^>]*>([^<]+)<',
webpage, 'title', default=None) or self._og_search_title(
webpage, default=None) or self._html_search_meta(
'twitter:title', webpage, 'title',
default=None) or webpage_info['episode']
return merge_dicts(info, webpage_info)
class ITVBTCCIE(InfoExtractor):