mirror of
https://github.com/yt-dlp/yt-dlp.git
synced 2024-11-13 12:43:05 +00:00
[youtube] Prefer meta for upload date and modernize
This commit is contained in:
parent
f0714c9f86
commit
9d0b581fea
@ -999,15 +999,16 @@ class YoutubeIE(YoutubeBaseInfoExtractor):
|
|||||||
video_thumbnail = compat_urllib_parse.unquote_plus(video_info['thumbnail_url'][0])
|
video_thumbnail = compat_urllib_parse.unquote_plus(video_info['thumbnail_url'][0])
|
||||||
|
|
||||||
# upload date
|
# upload date
|
||||||
upload_date = None
|
upload_date = self._html_search_meta(
|
||||||
mobj = re.search(r'(?s)id="eow-date.*?>(.*?)</span>', video_webpage)
|
'datePublished', video_webpage, 'upload date', default=None)
|
||||||
if mobj is None:
|
if not upload_date:
|
||||||
mobj = re.search(
|
upload_date = self._search_regex(
|
||||||
r'id="watch-uploader-info".*?>.*?(?:Published|Uploaded|Streamed live|Started) on (.*?)</strong>',
|
[r'(?s)id="eow-date.*?>(.*?)</span>',
|
||||||
video_webpage)
|
r'id="watch-uploader-info".*?>.*?(?:Published|Uploaded|Streamed live|Started) on (.+?)</strong>'],
|
||||||
if mobj is not None:
|
video_webpage, 'upload date', default=None)
|
||||||
upload_date = ' '.join(re.sub(r'[/,-]', r' ', mobj.group(1)).split())
|
if upload_date:
|
||||||
upload_date = unified_strdate(upload_date)
|
upload_date = ' '.join(re.sub(r'[/,-]', r' ', mobj.group(1)).split())
|
||||||
|
upload_date = unified_strdate(upload_date)
|
||||||
|
|
||||||
m_cat_container = self._search_regex(
|
m_cat_container = self._search_regex(
|
||||||
r'(?s)<h4[^>]*>\s*Category\s*</h4>\s*<ul[^>]*>(.*?)</ul>',
|
r'(?s)<h4[^>]*>\s*Category\s*</h4>\s*<ul[^>]*>(.*?)</ul>',
|
||||||
|
Loading…
Reference in New Issue
Block a user