mirror of https://github.com/mpv-player/mpv
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.
This commit is contained in:
parent
cb98d8d71c
commit
284fecc0bd
|
@ -215,7 +215,9 @@ end
|
||||||
local function parse_yt_playlist(url, json)
|
local function parse_yt_playlist(url, json)
|
||||||
-- return 0-based index to use with --playlist-start
|
-- 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
|
return nil
|
||||||
end
|
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
|
-- if there's no index or it doesn't match, look for video
|
||||||
for i = 1, #json.entries do
|
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))
|
msg.debug("found requested video in index " .. (i - 1))
|
||||||
return i - 1
|
return i - 1
|
||||||
end
|
end
|
||||||
|
|
Loading…
Reference in New Issue