From: Toni Gundogdu Date: Tue, 26 Nov 2013 14:27:36 +0000 (+0200) Subject: FIX: media/101greatgoals: redirect: Add URL scheme X-Git-Tag: v0.9.20131130~3^2~1 X-Git-Url: https://repo.or.cz/w/libquvi-scripts.git/commitdiff_plain/d74e442e61b740ae818f3fe9276630256f6b9718 FIX: media/101greatgoals: redirect: Add URL scheme Make sure the redirection URL has a scheme. Signed-off-by: Toni Gundogdu --- diff --git a/share/media/101greatgoals.lua b/share/media/101greatgoals.lua index b8f7fd5..13961a2 100644 --- a/share/media/101greatgoals.lua +++ b/share/media/101greatgoals.lua @@ -86,13 +86,18 @@ function HaOgg.chk_embedded(p) -- and pass it back to libquvi to find a media script that accepts the -- parsed (embedded) media URL. -- - -- NOTE: This means that those media scripts must unwrangle the embedded - -- media URLs passed from this script - -- local s = p:match('class="post%-type%-gvideos">(.-)(.-)') or error('unable to determine embedded source') - return s:match('value="(.-)"') or s:match('src="(.-)"') + + s = s:match('value="(.-)"') or s:match('src="(.-)"') + + local U = require 'socket.url' + local t = U.parse(s) + if not t.scheme then -- Make sure the URL has a scheme. + t.scheme = 'http' + end + return U.build(t) end -- vim: set ts=2 sw=2 tw=72 expandtab: