1
0
mirror of https://github.com/l1ving/youtube-dl synced 2025-03-12 00:57:15 +08:00

Merge branch 'ok-ru-timestamp' into fix.25.12.2018

This commit is contained in:
Avi Peretz 2018-12-27 23:57:56 +02:00
commit 56bdfea147

View File

@ -177,7 +177,7 @@ class OdnoklassnikiIE(InfoExtractor):
r'vp-layer-info_date">(?P<date>.*?)<\/span>',
webpage, 'upload date', group='date')
if upload_date_str:
from datetime import datetime
from datetime import datetime, timedelta
upload_date_time = None
try:
upload_date_time = datetime.strptime(upload_date_str, '%d %b %Y')
@ -189,9 +189,15 @@ class OdnoklassnikiIE(InfoExtractor):
except:
pass
try:
upload_date_time = datetime.strptime(upload_date_str, '%H:%M')
if upload_date_str.find(':') >=0:
hour_and_minutes = upload_date_str.split(' ')[-1]
else:
hour_and_minutes = upload_date_str
upload_date_time = datetime.strptime(hour_and_minutes, '%H:%M')
upload_date_time = upload_date_time.replace(year=datetime.utcnow().year)
upload_date_time = upload_date_time.replace(day=datetime.utcnow().day)
if upload_date_str.find('yesterday') ==0:
upload_date_time = upload_date_time - timedelta(days=1)
except:
pass