0
0
Fork 0
mirror of https://github.com/yt-dlp/yt-dlp.git synced 2024-11-27 03:03:01 +00:00

[lrt] fix the rest of extractor

Closes #7690.
This commit is contained in:
Giedrius Statkevičius 2015-11-29 02:58:52 +02:00 committed by Jaime Marquínez Ferrándiz
parent 85367c3a47
commit 339b1944e7

View file

@ -1,12 +1,8 @@
# coding: utf-8 # coding: utf-8
from __future__ import unicode_literals from __future__ import unicode_literals
import re
from .common import InfoExtractor from .common import InfoExtractor
from ..utils import ( from ..utils import (
determine_ext,
js_to_json,
parse_duration, parse_duration,
remove_end, remove_end,
) )
@ -25,7 +21,7 @@ class LRTIE(InfoExtractor):
'duration': 1783, 'duration': 1783,
}, },
'params': { 'params': {
'skip_download': True, # HLS download 'skip_download': True, # m3u8 download
}, },
} }
@ -39,23 +35,8 @@ def _real_extract(self, url):
duration = parse_duration(self._search_regex( duration = parse_duration(self._search_regex(
r"var record_len = '([0-9]+:[0-9]+:[0-9]+)';", webpage, 'record_len', fatal=False, default=None)) r"var record_len = '([0-9]+:[0-9]+:[0-9]+)';", webpage, 'record_len', fatal=False, default=None))
formats = [] link = self._search_regex(r'file: "(.*)" \+ location\.hash\.substring\(1\)', webpage, 'link to m3u8')
for js in re.findall(r'(?s)config:\s*(\{.*?\})', webpage): formats = self._extract_m3u8_formats(link, video_id, "mp4")
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'))
return { return {
'id': video_id, 'id': video_id,