Skip to content

Commit

Permalink
[redtube] Improve formats extraction and extract m3u8 formats (closes…
Browse files Browse the repository at this point in the history
… #25311, closes #25321)
  • Loading branch information
dstftw authored and pareronia committed Jun 22, 2020
1 parent f8a1973 commit 87df9e6
Showing 1 changed file with 8 additions and 1 deletion.
9 changes: 8 additions & 1 deletion youtube_dl/extractor/redtube.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@

from .common import InfoExtractor
from ..utils import (
determine_ext,
ExtractorError,
int_or_none,
merge_dicts,
Expand Down Expand Up @@ -77,14 +78,20 @@ def _real_extract(self, url):
})
medias = self._parse_json(
self._search_regex(
r'mediaDefinition\s*:\s*(\[.+?\])', webpage,
r'mediaDefinition["\']?\s*:\s*(\[.+?}\s*\])', webpage,
'media definitions', default='{}'),
video_id, fatal=False)
if medias and isinstance(medias, list):
for media in medias:
format_url = url_or_none(media.get('videoUrl'))
if not format_url:
continue
if media.get('format') == 'hls' or determine_ext(format_url) == 'm3u8':
formats.extend(self._extract_m3u8_formats(
format_url, video_id, 'mp4',
entry_protocol='m3u8_native', m3u8_id='hls',
fatal=False))
continue
format_id = media.get('quality')
formats.append({
'url': format_url,
Expand Down

0 comments on commit 87df9e6

Please sign in to comment.