mirror of
https://github.com/yt-dlp/yt-dlp.git
synced 2025-09-03 00:25:08 +00:00
[SponsorBlock] Add Filler and Highlight categories (#1664)
Authored by: nihil-admirari, pukkandan
This commit is contained in:
@ -10,18 +10,23 @@ from ..utils import PostProcessingError, network_exceptions, sanitized_Request
|
||||
|
||||
|
||||
class SponsorBlockPP(FFmpegPostProcessor):
|
||||
|
||||
# https://wiki.sponsor.ajay.app/w/Types
|
||||
EXTRACTORS = {
|
||||
'Youtube': 'YouTube',
|
||||
}
|
||||
POI_CATEGORIES = {
|
||||
'poi_highlight': 'Highlight',
|
||||
}
|
||||
CATEGORIES = {
|
||||
'sponsor': 'Sponsor',
|
||||
'intro': 'Intermission/Intro Animation',
|
||||
'outro': 'Endcards/Credits',
|
||||
'selfpromo': 'Unpaid/Self Promotion',
|
||||
'interaction': 'Interaction Reminder',
|
||||
'preview': 'Preview/Recap',
|
||||
'music_offtopic': 'Non-Music Section'
|
||||
'filler': 'Filler Tangent',
|
||||
'interaction': 'Interaction Reminder',
|
||||
'music_offtopic': 'Non-Music Section',
|
||||
**POI_CATEGORIES,
|
||||
}
|
||||
|
||||
def __init__(self, downloader, categories=None, api='https://sponsor.ajay.app'):
|
||||
@ -47,6 +52,9 @@ class SponsorBlockPP(FFmpegPostProcessor):
|
||||
# Ignore milliseconds difference at the start.
|
||||
if start_end[0] <= 1:
|
||||
start_end[0] = 0
|
||||
# Make POI chapters 1 sec so that we can properly mark them
|
||||
if s['category'] in self.POI_CATEGORIES.keys():
|
||||
start_end[1] += 1
|
||||
# Ignore milliseconds difference at the end.
|
||||
# Never allow the segment to exceed the video.
|
||||
if duration and duration - start_end[1] <= 1:
|
||||
|
Reference in New Issue
Block a user