mirror of
https://github.com/yt-dlp/yt-dlp.git
synced 2024-11-21 20:46:36 -05:00
[extractor/common] Change the default m3u8 protocol in HTML5
Helper functions should have consistent default values
This commit is contained in:
parent
d0fa172e5f
commit
ad120ae1c5
4 changed files with 8 additions and 5 deletions
|
@ -7,6 +7,7 @@ Core
|
||||||
* Fix js_to_json(): correct octal or hexadecimal number detection
|
* Fix js_to_json(): correct octal or hexadecimal number detection
|
||||||
|
|
||||||
Extractors
|
Extractors
|
||||||
|
+ [charlierose] Add new extractor (#10382)
|
||||||
+ [litv] Support 'promo' URLs (#10385)
|
+ [litv] Support 'promo' URLs (#10385)
|
||||||
* [snotr] Fix extraction (#10338)
|
* [snotr] Fix extraction (#10338)
|
||||||
* [n-tv.de] Fix extraction (#10331)
|
* [n-tv.de] Fix extraction (#10331)
|
||||||
|
|
|
@ -35,7 +35,8 @@ def _real_extract(self, url):
|
||||||
title = remove_end(self._og_search_title(webpage), ' - Charlie Rose')
|
title = remove_end(self._og_search_title(webpage), ' - Charlie Rose')
|
||||||
|
|
||||||
info_dict = self._parse_html5_media_entries(
|
info_dict = self._parse_html5_media_entries(
|
||||||
self._PLAYER_BASE % video_id, webpage, video_id)[0]
|
self._PLAYER_BASE % video_id, webpage, video_id,
|
||||||
|
m3u8_entry_protocol='m3u8_native')[0]
|
||||||
|
|
||||||
self._sort_formats(info_dict['formats'])
|
self._sort_formats(info_dict['formats'])
|
||||||
self._remove_duplicate_formats(info_dict['formats'])
|
self._remove_duplicate_formats(info_dict['formats'])
|
||||||
|
|
|
@ -1695,7 +1695,7 @@ def add_segment_url():
|
||||||
self.report_warning('Unknown MIME type %s in DASH manifest' % mime_type)
|
self.report_warning('Unknown MIME type %s in DASH manifest' % mime_type)
|
||||||
return formats
|
return formats
|
||||||
|
|
||||||
def _parse_html5_media_entries(self, base_url, webpage, video_id, m3u8_id=None):
|
def _parse_html5_media_entries(self, base_url, webpage, video_id, m3u8_id=None, m3u8_entry_protocol='m3u8'):
|
||||||
def absolute_url(video_url):
|
def absolute_url(video_url):
|
||||||
return compat_urlparse.urljoin(base_url, video_url)
|
return compat_urlparse.urljoin(base_url, video_url)
|
||||||
|
|
||||||
|
@ -1715,8 +1715,8 @@ def _media_formats(src, cur_media_type):
|
||||||
if determine_ext(full_url) == 'm3u8':
|
if determine_ext(full_url) == 'm3u8':
|
||||||
is_plain_url = False
|
is_plain_url = False
|
||||||
formats = self._extract_m3u8_formats(
|
formats = self._extract_m3u8_formats(
|
||||||
full_url, video_id, ext='mp4', entry_protocol='m3u8_native',
|
full_url, video_id, ext='mp4',
|
||||||
m3u8_id=m3u8_id)
|
entry_protocol=m3u8_entry_protocol, m3u8_id=m3u8_id)
|
||||||
else:
|
else:
|
||||||
is_plain_url = True
|
is_plain_url = True
|
||||||
formats = [{
|
formats = [{
|
||||||
|
|
|
@ -46,7 +46,8 @@ def _real_extract(self, url):
|
||||||
title = self._og_search_title(webpage)
|
title = self._og_search_title(webpage)
|
||||||
|
|
||||||
description = self._og_search_description(webpage)
|
description = self._og_search_description(webpage)
|
||||||
info_dict = self._parse_html5_media_entries(url, webpage, video_id)[0]
|
info_dict = self._parse_html5_media_entries(
|
||||||
|
url, webpage, video_id, m3u8_entry_protocol='m3u8_native')[0]
|
||||||
|
|
||||||
view_count = str_to_int(self._html_search_regex(
|
view_count = str_to_int(self._html_search_regex(
|
||||||
r'<p[^>]*>\s*<strong[^>]*>Views:</strong>\s*<span[^>]*>([\d,\.]+)',
|
r'<p[^>]*>\s*<strong[^>]*>Views:</strong>\s*<span[^>]*>([\d,\.]+)',
|
||||||
|
|
Loading…
Reference in a new issue