From ea4023a270b83d146264c9f7cbf8dcf1cdb0fd1c Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Elan=20Ruusam=C3=A4e?= Date: Wed, 2 Jan 2019 23:07:14 +0200 Subject: [PATCH] [kanal2]: adjust time with timezone local to the provider --- youtube_dl/extractor/kanal2.py | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) diff --git a/youtube_dl/extractor/kanal2.py b/youtube_dl/extractor/kanal2.py index 99896c067..d14501b8c 100644 --- a/youtube_dl/extractor/kanal2.py +++ b/youtube_dl/extractor/kanal2.py @@ -9,6 +9,7 @@ from ..utils import ( url_or_none, ) + class Kanal2IE(InfoExtractor): 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') 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): formats = []