diff options
author | Ricardo Constantino <wiiaboo@gmail.com> | 2018-02-10 13:12:47 +0000 |
---|---|---|
committer | Kevin Mitchell <kevmitch@gmail.com> | 2018-02-11 23:27:37 -0800 |
commit | f670c64e59119fc91675d8eccf1e350365ee2f55 (patch) | |
tree | a3debf23328c9ebc31245a12b9b057dae49f12bb /player/lua/ytdl_hook.lua | |
parent | 57228b65810f1026f1ac10a0df86d7434289c345 (diff) | |
download | mpv-f670c64e59119fc91675d8eccf1e350365ee2f55.tar.bz2 mpv-f670c64e59119fc91675d8eccf1e350365ee2f55.tar.xz |
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
Diffstat (limited to 'player/lua/ytdl_hook.lua')
-rw-r--r-- | player/lua/ytdl_hook.lua | 8 |
1 files changed, 6 insertions, 2 deletions
diff --git a/player/lua/ytdl_hook.lua b/player/lua/ytdl_hook.lua index 3c5068bfd7..8bf088fe5f 100644 --- a/player/lua/ytdl_hook.lua +++ b/player/lua/ytdl_hook.lua @@ -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 |