From 4f37cd132854274812722c64b16a825c94426967 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Giedrius=20Statkevi=C4=8Dius?= Date: Sat, 28 Nov 2015 23:14:38 +0200 Subject: [PATCH 1/3] [lrt] fix duration parsing --- youtube_dl/extractor/lrt.py | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/youtube_dl/extractor/lrt.py b/youtube_dl/extractor/lrt.py index e3236f7b5..24a9a4c91 100644 --- a/youtube_dl/extractor/lrt.py +++ b/youtube_dl/extractor/lrt.py @@ -37,8 +37,7 @@ class LRTIE(InfoExtractor): thumbnail = self._og_search_thumbnail(webpage) description = self._og_search_description(webpage) duration = parse_duration(self._search_regex( - r"'duration':\s*'([^']+)',", webpage, - 'duration', fatal=False, default=None)) + r"var record_len = '([0-9]+:[0-9]+:[0-9]+)';", webpage, 'record_len', fatal=False, default=None)) formats = [] for js in re.findall(r'(?s)config:\s*(\{.*?\})', webpage): From 972cb93374d94508a7bc3fe7db3eb9651e94bab4 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Giedrius=20Statkevi=C4=8Dius?= Date: Sun, 29 Nov 2015 02:58:52 +0200 Subject: [PATCH 2/3] [lrt] fix the rest of extractor --- youtube_dl/extractor/lrt.py | 22 ++++------------------ 1 file changed, 4 insertions(+), 18 deletions(-) diff --git a/youtube_dl/extractor/lrt.py b/youtube_dl/extractor/lrt.py index 24a9a4c91..ed41aad84 100644 --- a/youtube_dl/extractor/lrt.py +++ b/youtube_dl/extractor/lrt.py @@ -25,7 +25,7 @@ class LRTIE(InfoExtractor): 'duration': 1783, }, 'params': { - 'skip_download': True, # HLS download + 'skip_download': True, # m3u8 download }, } @@ -39,23 +39,9 @@ class LRTIE(InfoExtractor): duration = parse_duration(self._search_regex( r"var record_len = '([0-9]+:[0-9]+:[0-9]+)';", webpage, 'record_len', fatal=False, default=None)) - formats = [] - for js in re.findall(r'(?s)config:\s*(\{.*?\})', webpage): - data = self._parse_json(js, video_id, transform_source=js_to_json) - if 'provider' not in data: - continue - if data['provider'] == 'rtmp': - formats.append({ - 'format_id': 'rtmp', - 'ext': determine_ext(data['file']), - 'url': data['streamer'], - 'play_path': 'mp4:%s' % data['file'], - 'preference': -1, - 'rtmp_real_time': True, - }) - else: - formats.extend( - self._extract_m3u8_formats(data['file'], video_id, 'mp4')) + link = self._search_regex(r'file: "(.*)" \+ location\.hash\.substring\(1\)', webpage, 'link to m3u8') + link += video_id + formats = self._extract_m3u8_formats(link, video_id, "mp4") return { 'id': video_id, From fbb2b82ede192ac948acb530b012c034dd6f3b16 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Giedrius=20Statkevi=C4=8Dius?= Date: Sun, 29 Nov 2015 03:16:19 +0200 Subject: [PATCH 3/3] [lrt] fix issues reported by flake8 --- youtube_dl/extractor/lrt.py | 4 ---- 1 file changed, 4 deletions(-) diff --git a/youtube_dl/extractor/lrt.py b/youtube_dl/extractor/lrt.py index ed41aad84..c4051bce1 100644 --- a/youtube_dl/extractor/lrt.py +++ b/youtube_dl/extractor/lrt.py @@ -1,12 +1,8 @@ # coding: utf-8 from __future__ import unicode_literals -import re - from .common import InfoExtractor from ..utils import ( - determine_ext, - js_to_json, parse_duration, remove_end, )