]> git.bitcoin.ninja Git - youtube-dl/commitdiff
[once] Prevent ads from embedding into m3u8 playlists (Closes #8893)
authorSergey M․ <dstftw@gmail.com>
Tue, 22 Mar 2016 17:48:05 +0000 (23:48 +0600)
committerSergey M․ <dstftw@gmail.com>
Tue, 22 Mar 2016 17:48:05 +0000 (23:48 +0600)
youtube_dl/extractor/once.py

index 080045d4c1446875cb40fdf85c516e1e4cc419a3..5db949b176141863a290adfcd1fe3bbda11076b7 100644 (file)
@@ -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)