[itv] Make SOAP request non fatal and extract metadata from a webpage (closes #16780)
This commit is contained in:
parent
91aa502d91
commit
30374f4d40
1 changed files with 69 additions and 57 deletions
|
@ -18,6 +18,7 @@ from ..utils import (
|
||||||
xpath_element,
|
xpath_element,
|
||||||
xpath_text,
|
xpath_text,
|
||||||
int_or_none,
|
int_or_none,
|
||||||
|
merge_dicts,
|
||||||
parse_duration,
|
parse_duration,
|
||||||
smuggle_url,
|
smuggle_url,
|
||||||
ExtractorError,
|
ExtractorError,
|
||||||
|
@ -129,7 +130,8 @@ class ITVIE(InfoExtractor):
|
||||||
|
|
||||||
resp_env = self._download_xml(
|
resp_env = self._download_xml(
|
||||||
params['data-playlist-url'], video_id,
|
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')
|
playlist = xpath_element(resp_env, './/Playlist')
|
||||||
if playlist is None:
|
if playlist is None:
|
||||||
fault_code = xpath_text(resp_env, './/faultcode')
|
fault_code = xpath_text(resp_env, './/faultcode')
|
||||||
|
@ -261,7 +263,17 @@ class ITVIE(InfoExtractor):
|
||||||
'formats': formats,
|
'formats': formats,
|
||||||
'subtitles': subtitles,
|
'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):
|
class ITVBTCCIE(InfoExtractor):
|
||||||
|
|
Loading…
Reference in a new issue