From 7a34b5d628ad3b92a14ee7f51daa1cab9e326615 Mon Sep 17 00:00:00 2001 From: Nil Admirari <50202386+nihil-admirari@users.noreply.github.com> Date: Tue, 22 Feb 2022 14:18:44 +0000 Subject: [PATCH] [SponsorBlock] Fixes for highlight and "full video labels" (#2849) Authored by: nihil-admirari --- yt_dlp/postprocessor/sponsorblock.py | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/yt_dlp/postprocessor/sponsorblock.py b/yt_dlp/postprocessor/sponsorblock.py index cd48b15ae..e7e04e86e 100644 --- a/yt_dlp/postprocessor/sponsorblock.py +++ b/yt_dlp/postprocessor/sponsorblock.py @@ -49,6 +49,9 @@ def _get_sponsor_chapters(self, info, duration): def duration_filter(s): start_end = s['segment'] + # Ignore entire video segments (https://wiki.sponsor.ajay.app/w/Types). + if start_end == (0, 0): + return False # Ignore milliseconds difference at the start. if start_end[0] <= 1: start_end[0] = 0 @@ -89,6 +92,7 @@ def _get_sponsor_segments(self, video_id, service): url = f'{self._API_URL}/api/skipSegments/{hash[:4]}?' + compat_urllib_parse_urlencode({ 'service': service, 'categories': json.dumps(self._categories), + 'actionTypes': json.dumps(['skip', 'poi']) }) self.write_debug(f'SponsorBlock query: {url}') for d in self._get_json(url):