mirror of
https://github.com/yt-dlp/yt-dlp.git
synced 2024-11-21 20:46:36 -05:00
[once] Prevent ads from embedding into m3u8 playlists (Closes #8893)
This commit is contained in:
parent
2beeb286e1
commit
c6ca11f1b3
1 changed files with 4 additions and 0 deletions
|
@ -20,6 +20,10 @@ def _extract_once_formats(self, url):
|
||||||
media_item_id, 'mp4', m3u8_id='hls', fatal=False)
|
media_item_id, 'mp4', m3u8_id='hls', fatal=False)
|
||||||
progressive_formats = []
|
progressive_formats = []
|
||||||
for adaptive_format in formats:
|
for adaptive_format in formats:
|
||||||
|
# Prevent advertisement from embedding into m3u8 playlist (see
|
||||||
|
# https://github.com/rg3/youtube-dl/issues/8893#issuecomment-199912684)
|
||||||
|
adaptive_format['url'] = re.sub(
|
||||||
|
r'\badsegmentlength=\d+', r'adsegmentlength=0', adaptive_format['url'])
|
||||||
rendition_id = self._search_regex(
|
rendition_id = self._search_regex(
|
||||||
r'/now/media/playlist/[^/]+/[^/]+/([^/]+)',
|
r'/now/media/playlist/[^/]+/[^/]+/([^/]+)',
|
||||||
adaptive_format['url'], 'redition id', default=None)
|
adaptive_format['url'], 'redition id', default=None)
|
||||||
|
|
Loading…
Reference in a new issue