From 284fecc0bdd8152a35a35a387faf5d4675b8f0c8 Mon Sep 17 00:00:00 2001 From: Christoph Heinrich Date: Tue, 26 Jul 2022 20:19:44 +0200 Subject: ytdl_hook: fix playlist index extraction The example given in #3024 would not play the correct video when combined with `--ytdl-raw-options=yes-playlist=`. Allowing `youtube:tab` as extractor and correcting the id check fixes that. --- player/lua/ytdl_hook.lua | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) (limited to 'player/lua') diff --git a/player/lua/ytdl_hook.lua b/player/lua/ytdl_hook.lua index 7ff5f5ea00..41fe97bf33 100644 --- a/player/lua/ytdl_hook.lua +++ b/player/lua/ytdl_hook.lua @@ -215,7 +215,9 @@ end local function parse_yt_playlist(url, json) -- return 0-based index to use with --playlist-start - if not json.extractor or json.extractor ~= "youtube:playlist" then + if not json.extractor or + (json.extractor ~= "youtube:tab" and + json.extractor ~= "youtube:playlist") then return nil end @@ -240,7 +242,7 @@ local function parse_yt_playlist(url, json) -- if there's no index or it doesn't match, look for video for i = 1, #json.entries do - if json.entries[i] == args["v"] then + if json.entries[i].id == args["v"] then msg.debug("found requested video in index " .. (i - 1)) return i - 1 end -- cgit v1.2.3