mirror of
https://github.com/yt-dlp/yt-dlp.git
synced 2024-11-21 20:46:36 -05:00
[SponsorBlock] Fixes for highlight and "full video labels" (#2849)
Authored by: nihil-admirari
This commit is contained in:
parent
4d4f9a029f
commit
7a34b5d628
1 changed files with 4 additions and 0 deletions
|
@ -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):
|
||||
|
|
Loading…
Reference in a new issue