summaryrefslogtreecommitdiffstats
path: root/player
diff options
context:
space:
mode:
authorChristoph Heinrich <christoph.heinrich@student.tugraz.at>2022-07-26 20:19:44 +0200
committerDudemanguy <random342@airmail.cc>2022-07-26 21:16:23 +0000
commit284fecc0bdd8152a35a35a387faf5d4675b8f0c8 (patch)
tree43a3bb63aafd00463069ac015177bf58e78828a7 /player
parentcb98d8d71ccf6d570d94c62530bae4e4cbf65d52 (diff)
downloadmpv-284fecc0bdd8152a35a35a387faf5d4675b8f0c8.tar.bz2
mpv-284fecc0bdd8152a35a35a387faf5d4675b8f0c8.tar.xz
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.
Diffstat (limited to 'player')
-rw-r--r--player/lua/ytdl_hook.lua6
1 files changed, 4 insertions, 2 deletions
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