mirror of
https://github.com/yt-dlp/yt-dlp.git
synced 2024-12-25 22:54:29 +00:00
[arte] Improve extraction (Closes #8768)
This commit is contained in:
parent
1818e4c2b4
commit
46c329d6f6
1 changed files with 6 additions and 3 deletions
|
@ -121,7 +121,10 @@ def find_iframe_url(webpage, default=NO_DEFAULT):
|
||||||
json_url = compat_parse_qs(
|
json_url = compat_parse_qs(
|
||||||
compat_urllib_parse_urlparse(iframe_url).query)['json_url'][0]
|
compat_urllib_parse_urlparse(iframe_url).query)['json_url'][0]
|
||||||
if json_url:
|
if json_url:
|
||||||
return self._extract_from_json_url(json_url, video_id, lang)
|
title = self._search_regex(
|
||||||
|
r'<h3[^>]+title=(["\'])(?P<title>.+?)\1',
|
||||||
|
webpage, 'title', default=None, group='title')
|
||||||
|
return self._extract_from_json_url(json_url, video_id, lang, title=title)
|
||||||
# Different kind of embed URL (e.g.
|
# Different kind of embed URL (e.g.
|
||||||
# http://www.arte.tv/magazine/trepalium/fr/episode-0406-replay-trepalium)
|
# http://www.arte.tv/magazine/trepalium/fr/episode-0406-replay-trepalium)
|
||||||
embed_url = self._search_regex(
|
embed_url = self._search_regex(
|
||||||
|
@ -129,7 +132,7 @@ def find_iframe_url(webpage, default=NO_DEFAULT):
|
||||||
webpage, 'embed url', group='url')
|
webpage, 'embed url', group='url')
|
||||||
return self.url_result(embed_url)
|
return self.url_result(embed_url)
|
||||||
|
|
||||||
def _extract_from_json_url(self, json_url, video_id, lang):
|
def _extract_from_json_url(self, json_url, video_id, lang, title=None):
|
||||||
info = self._download_json(json_url, video_id)
|
info = self._download_json(json_url, video_id)
|
||||||
player_info = info['videoJsonPlayer']
|
player_info = info['videoJsonPlayer']
|
||||||
|
|
||||||
|
@ -137,7 +140,7 @@ def _extract_from_json_url(self, json_url, video_id, lang):
|
||||||
if not upload_date_str:
|
if not upload_date_str:
|
||||||
upload_date_str = (player_info.get('VRA') or player_info.get('VDA') or '').split(' ')[0]
|
upload_date_str = (player_info.get('VRA') or player_info.get('VDA') or '').split(' ')[0]
|
||||||
|
|
||||||
title = player_info['VTI'].strip()
|
title = (player_info.get('VTI') or title or player_info['VID']).strip()
|
||||||
subtitle = player_info.get('VSU', '').strip()
|
subtitle = player_info.get('VSU', '').strip()
|
||||||
if subtitle:
|
if subtitle:
|
||||||
title += ' - %s' % subtitle
|
title += ' - %s' % subtitle
|
||||||
|
|
Loading…
Reference in a new issue