From e2ae5cd409c1ee4ecc7a91caa8ac8333f0dc8979 Mon Sep 17 00:00:00 2001 From: JanBecker Date: Sun, 11 Apr 2021 19:12:52 +0200 Subject: [PATCH] Search for Youtube-IDs in local files If a file is downloaded with youtube-dl, the youtube-ID remains in the filename. sponsorblock-minimal should find that ID and skip segments in downloaded youtube-videos. --- sponsorblock_minimal.lua | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/sponsorblock_minimal.lua b/sponsorblock_minimal.lua index 9d96ec4..9920d23 100644 --- a/sponsorblock_minimal.lua +++ b/sponsorblock_minimal.lua @@ -55,7 +55,8 @@ function file_loaded() local youtube_id2 = string.match(video_path, "https?://w?w?w?%.?youtube%.com/v/([%w-_]+).*") local youtube_id3 = string.match(video_path, "/watch.*[?&]v=([%w-_]+).*") local youtube_id4 = string.match(video_path, "/embed/([%w-_]+).*") - youtube_id = youtube_id1 or youtube_id2 or youtube_id3 or youtube_id4 + local youtube_id5 = string.match(video_path, ".*-([%w-_]+).*") + youtube_id = youtube_id1 or youtube_id2 or youtube_id3 or youtube_id4 or youtube_id5 if not youtube_id or string.len(youtube_id) < 11 then return end youtube_id = string.sub(youtube_id, 1, 11)