mirror of
https://github.com/yt-dlp/yt-dlp.git
synced 2024-11-27 03:03:01 +00:00
[extractor/common] Extract upload date from SMIL
This commit is contained in:
parent
1e5bcdec02
commit
647eab4541
1 changed files with 5 additions and 0 deletions
|
@ -39,6 +39,7 @@
|
|||
RegexNotFoundError,
|
||||
sanitize_filename,
|
||||
unescapeHTML,
|
||||
unified_strdate,
|
||||
url_basename,
|
||||
xpath_text,
|
||||
xpath_with_ns,
|
||||
|
@ -1044,6 +1045,7 @@ def _parse_smil(self, smil, smil_url, video_id, f4m_params=None):
|
|||
video_id = os.path.splitext(url_basename(smil_url))[0]
|
||||
title = None
|
||||
description = None
|
||||
upload_date = None
|
||||
for meta in smil.findall(self._xpath_ns('./head/meta', namespace)):
|
||||
name = meta.attrib.get('name')
|
||||
content = meta.attrib.get('content')
|
||||
|
@ -1053,6 +1055,8 @@ def _parse_smil(self, smil, smil_url, video_id, f4m_params=None):
|
|||
title = content
|
||||
elif not description and name in ('description', 'abstract'):
|
||||
description = content
|
||||
elif not upload_date and name == 'date':
|
||||
upload_date = unified_strdate(content)
|
||||
|
||||
thumbnails = [{
|
||||
'id': image.get('type'),
|
||||
|
@ -1065,6 +1069,7 @@ def _parse_smil(self, smil, smil_url, video_id, f4m_params=None):
|
|||
'id': video_id,
|
||||
'title': title or video_id,
|
||||
'description': description,
|
||||
'upload_date': upload_date,
|
||||
'thumbnails': thumbnails,
|
||||
'formats': formats,
|
||||
'subtitles': subtitles,
|
||||
|
|
Loading…
Reference in a new issue