]> jfr.im git - yt-dlp.git/blobdiff - yt_dlp/extractor/ccma.py
[generic] Extract subtitles from video.js (#3156)
[yt-dlp.git] / yt_dlp / extractor / ccma.py
index ea98f8688ea7216260f779bada1417e4a99999b2..9dbaabfa087b4bd33e3a33678879878a7172c5d6 100644 (file)
@@ -1,17 +1,14 @@
 # coding: utf-8
 from __future__ import unicode_literals
 
-import calendar
-import datetime
-
 from .common import InfoExtractor
 from ..utils import (
     clean_html,
-    extract_timezone,
     int_or_none,
     parse_duration,
     parse_resolution,
     try_get,
+    unified_timestamp,
     url_or_none,
 )
 
@@ -95,14 +92,8 @@ def _real_extract(self, url):
         duration = int_or_none(durada.get('milisegons'), 1000) or parse_duration(durada.get('text'))
         tematica = try_get(informacio, lambda x: x['tematica']['text'])
 
-        timestamp = None
         data_utc = try_get(informacio, lambda x: x['data_emissio']['utc'])
-        try:
-            timezone, data_utc = extract_timezone(data_utc)
-            timestamp = calendar.timegm((datetime.datetime.strptime(
-                data_utc, '%Y-%d-%mT%H:%M:%S') - timezone).timetuple())
-        except TypeError:
-            pass
+        timestamp = unified_timestamp(data_utc)
 
         subtitles = {}
         subtitols = media.get('subtitols') or []