1
0
mirror of https://github.com/yt-dlp/yt-dlp.git synced 2024-11-05 02:32:44 +01:00

[vrtnu] Relax title extraction and extract JSON-LD (closes #17018)

This commit is contained in:
Sergey M․ 2018-07-20 02:39:20 +07:00
parent 25586c601c
commit fd62b36680
No known key found for this signature in database
GPG Key ID: 2C393E0F18A9236D

View File

@ -11,6 +11,7 @@
strip_or_none,
float_or_none,
int_or_none,
merge_dicts,
parse_iso8601,
)
@ -248,9 +249,13 @@ def _real_extract(self, url):
webpage, urlh = self._download_webpage_handle(url, display_id)
title = self._html_search_regex(
info = self._search_json_ld(webpage, display_id, default={})
# title is optional here since it may be extracted by extractor
# that is delegated from here
title = strip_or_none(self._html_search_regex(
r'(?ms)<h1 class="content__heading">(.+?)</h1>',
webpage, 'title').strip()
webpage, 'title', default=None))
description = self._html_search_regex(
r'(?ms)<div class="content__description">(.+?)</div>',
@ -295,7 +300,7 @@ def _real_extract(self, url):
# the first one
video_id = list(video.values())[0].get('videoid')
return {
return merge_dicts(info, {
'_type': 'url_transparent',
'url': 'https://mediazone.vrt.be/api/v1/vrtvideo/assets/%s' % video_id,
'ie_key': CanvasIE.ie_key(),
@ -307,4 +312,4 @@ def _real_extract(self, url):
'season_number': season_number,
'episode_number': episode_number,
'release_date': release_date,
}
})