aboutsummaryrefslogtreecommitdiffhomepage
path: root/youtube_dl/extractor/once.py
diff options
context:
space:
mode:
authorSergey M․ <[email protected]>2016-03-22 23:48:05 +0600
committerSergey M․ <[email protected]>2016-03-22 23:48:05 +0600
commitc6ca11f1b31a292413cab03012654fd0021814a8 (patch)
treee3565208881eb47a9404375161420ece4f7097a0 /youtube_dl/extractor/once.py
parent2beeb286e179a00bc0c76fc55ca5c8d19e74ca41 (diff)
downloadyoutube-dl-c6ca11f1b31a292413cab03012654fd0021814a8.tar.gz
youtube-dl-c6ca11f1b31a292413cab03012654fd0021814a8.zip
[once] Prevent ads from embedding into m3u8 playlists (Closes #8893)
Diffstat (limited to 'youtube_dl/extractor/once.py')
-rw-r--r--youtube_dl/extractor/once.py4
1 files changed, 4 insertions, 0 deletions
diff --git a/youtube_dl/extractor/once.py b/youtube_dl/extractor/once.py
index 080045d4c..5db949b17 100644
--- a/youtube_dl/extractor/once.py
+++ b/youtube_dl/extractor/once.py
@@ -20,6 +20,10 @@ class OnceIE(InfoExtractor):
media_item_id, 'mp4', m3u8_id='hls', fatal=False)
progressive_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(
r'/now/media/playlist/[^/]+/[^/]+/([^/]+)',
adaptive_format['url'], 'redition id', default=None)