1
0
mirror of https://codeberg.org/polarisfm/youtube-dl synced 2024-11-30 04:08:01 +01:00

Fix date parsing for YouTube (patch by Drake Wyrm)

This commit is contained in:
Ricardo Garcia 2011-02-25 19:05:35 +01:00
parent ef9f8451c8
commit 87cbd21323

View File

@ -1059,7 +1059,7 @@ class YoutubeIE(InfoExtractor):
mobj = re.search(r'id="eow-date".*?>(.*?)</span>', video_webpage, re.DOTALL) mobj = re.search(r'id="eow-date".*?>(.*?)</span>', video_webpage, re.DOTALL)
if mobj is not None: if mobj is not None:
upload_date = ' '.join(re.sub(r'[/,-]', r' ', mobj.group(1)).split()) upload_date = ' '.join(re.sub(r'[/,-]', r' ', mobj.group(1)).split())
format_expressions = ['%d %B %Y', '%B %d %Y'] format_expressions = ['%d %B %Y', '%B %d %Y', '%b %d %Y']
for expression in format_expressions: for expression in format_expressions:
try: try:
upload_date = datetime.datetime.strptime(upload_date, expression).strftime('%Y%m%d') upload_date = datetime.datetime.strptime(upload_date, expression).strftime('%Y%m%d')