1
mirror of https://github.com/mpv-player/mpv synced 2024-11-18 21:16:10 +01:00

ytdl_hook: add ytdl:// prefix again for non-youtube playlists

Only youtube playlists return ID-only urls. Other extractors may
return "<extractor>:<ID>" so those still need the ytdl:// prefix.

Reproduced with
http://www.cbc.ca/burdenoftruth/videos/trailers-promos/burden-of-truth-returns
This commit is contained in:
Ricardo Constantino 2018-02-10 13:12:47 +00:00 committed by Kevin Mitchell
parent 57228b6581
commit f670c64e59
No known key found for this signature in database
GPG Key ID: 559A34B46A917232

View File

@ -626,9 +626,13 @@ mp.add_hook(o.try_ytdl_first and "on_load" or "on_load_fail", 10, function ()
site = entry["webpage_url"]
end
-- links with only youtube id as returned by --flat-playlist
-- links without protocol as returned by --flat-playlist
if not site:find("://") then
table.insert(playlist, "https://youtu.be/" .. site)
-- youtube extractor provides only IDs,
-- others come prefixed with the extractor name and ":"
local prefix = site:find(":") and "ytdl://" or
"https://youtu.be/"
table.insert(playlist, prefix .. site)
elseif url_is_safe(site) then
table.insert(playlist, site)
end