1
0
mirror of https://codeberg.org/polarisfm/youtube-dl synced 2024-11-26 02:14:32 +01:00

[kanal2]: adjust time with timezone local to the provider

This commit is contained in:
Elan Ruusamäe 2019-01-02 23:07:14 +02:00
parent 906e495093
commit ea4023a270

View File

@ -9,6 +9,7 @@ from ..utils import (
url_or_none, url_or_none,
) )
class Kanal2IE(InfoExtractor): class Kanal2IE(InfoExtractor):
SUBTITLE_DATE_RE = re.compile(r'\((\d{2}\.\d{2}\.\d{4}\s\d{2}:\d{2})\)$') SUBTITLE_DATE_RE = re.compile(r'\((\d{2}\.\d{2}\.\d{4}\s\d{2}:\d{2})\)$')
@ -67,7 +68,15 @@ class Kanal2IE(InfoExtractor):
date = datetime.strptime(match, '%d.%m.%Y %H:%M') date = datetime.strptime(match, '%d.%m.%Y %H:%M')
unixtime = time.mktime(date.timetuple()) unixtime = time.mktime(date.timetuple())
return int(unixtime) try:
import pytz
# the time is always in this timezone
tz = pytz.timezone('Europe/Tallinn')
unixtime += tz.utcoffset(date).microseconds
except ImportError:
pass
return unixtime
def get_formats(self, playlist, video_id): def get_formats(self, playlist, video_id):
formats = [] formats = []