0
0
Fork 0
mirror of https://github.com/yt-dlp/yt-dlp.git synced 2024-11-27 03:03:01 +00: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 @@
xpath_element,
xpath_text,
int_or_none,
merge_dicts,
parse_duration,
smuggle_url,
ExtractorError,
@ -129,7 +130,8 @@ def extract_subtitle(sub_url):
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 @@ def extract_subtitle(sub_url):
'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):