Merge pull request #320 from ticoombs/main

feat: initial sponsorblock support
This commit is contained in:
meeb 2023-02-03 17:50:48 +11:00 committed by GitHub
commit b8434ff444
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 10 additions and 2 deletions

View File

@ -64,7 +64,7 @@ def get_media_info(url):
return response return response
def download_media(url, media_format, extension, output_file, info_json): def download_media(url, media_format, extension, output_file, info_json, sponsor_categories="all"):
''' '''
Downloads a YouTube URL to a file on disk. Downloads a YouTube URL to a file on disk.
''' '''
@ -108,7 +108,15 @@ def download_media(url, media_format, extension, output_file, info_json):
'outtmpl': output_file, 'outtmpl': output_file,
'quiet': True, 'quiet': True,
'progress_hooks': [hook], 'progress_hooks': [hook],
'writeinfojson': info_json 'writeinfojson': info_json,
'postprocessors': [{
'key': 'SponsorBlock',
'categories': [sponsor_categories]
},{
'key': 'FFmpegMetadata',
'add_chapters': True,
'add_metadata': True
}]
}) })
with yt_dlp.YoutubeDL(opts) as y: with yt_dlp.YoutubeDL(opts) as y:
try: try: