Change getting video id method
This commit is contained in:
parent
b9ce682bf0
commit
d608ee9429
|
@ -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()
|
||||
|
|
Reference in New Issue