Browse Source

Change getting video id method

master
blank X 11 months ago
parent
commit
d608ee9429
Signed by: blankie GPG Key ID: CC15FC822C7F61F5
  1. 10
      sponsorblock_minimal.lua

10
sponsorblock_minimal.lua

@ -51,12 +51,10 @@ end
function file_loaded()
local video_path = mp.get_property("path")
local youtube_id1 = string.match(video_path, "https?://youtu%.be/([%w-_]+).*")
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
if not youtube_id or string.len(youtube_id) < 11 then return end
local video_title = mp.get_property("media-title")
youtube_id = string.match(video_title, ".* %(([%w-_]+)%)")
print(youtube_id)
if not string.match(video_path, "https?://.*%.?googlevideo%.com/.*") or not youtube_id or string.len(youtube_id) < 11 then return end
youtube_id = string.sub(youtube_id, 1, 11)
getranges()

Loading…
Cancel
Save