Skip to content

Commit

Permalink
[ie/generic] Improve direct video link ext detection (#8340)
Browse files Browse the repository at this point in the history
Closes #8265
Authored by: bashonly
  • Loading branch information
bashonly committed Oct 28, 2023
1 parent 177f0d9 commit 4ce2f29
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion yt_dlp/extractor/generic.py
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,7 @@
unified_timestamp,
unsmuggle_url,
update_url_query,
urlhandle_detect_ext,
url_or_none,
urljoin,
variadic,
Expand Down Expand Up @@ -2459,7 +2460,7 @@ def _real_extract(self, url):
self.report_detected('direct video link')
headers = smuggled_data.get('http_headers', {})
format_id = str(m.group('format_id'))
ext = determine_ext(url)
ext = determine_ext(url, default_ext=None) or urlhandle_detect_ext(full_response)
subtitles = {}
if format_id.endswith('mpegurl') or ext == 'm3u8':
formats, subtitles = self._extract_m3u8_formats_and_subtitles(url, video_id, 'mp4', headers=headers)
Expand All @@ -2471,6 +2472,7 @@ def _real_extract(self, url):
formats = [{
'format_id': format_id,
'url': url,
'ext': ext,
'vcodec': 'none' if m.group('type') == 'audio' else None
}]
info_dict['direct'] = True
Expand Down

0 comments on commit 4ce2f29

Please sign in to comment.