From a24b7aa9ec6f4393ef7b09db753b2e2822608e79 Mon Sep 17 00:00:00 2001 From: Toni Gundogdu Date: Tue, 18 Jun 2013 18:46:45 +0300 Subject: [PATCH] media/guardian.lua: Check for expired content (BACKPORTpt4) * Backported from maint-0.4 (22ff394) Signed-off-by: Toni Gundogdu --- share/media/guardian.lua | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/share/media/guardian.lua b/share/media/guardian.lua index 2fc2924..7d82526 100644 --- a/share/media/guardian.lua +++ b/share/media/guardian.lua @@ -30,7 +30,7 @@ end -- Parse the media properties. function parse(qargs) - local p = quvi.http.fetch(qargs.input_url).data + local p = Guardian.fetch(qargs) qargs.duration_ms = tonumber(p:match('duration%:%s+"?(%d+)"?') or 0) * 1000 @@ -66,6 +66,13 @@ function Guardian.can_parse_url(qargs) end end +function Guardian.fetch(qargs) + local p = quvi.http.fetch(qargs.input_url).data + local e = p:match('
.-

(.-)

.-
') or '' + if #e >0 then error(e) end + return p +end + function Guardian.iter_streams(p) local u = p:match('file:%s+"(.-)"') or error("no match: media stream URL") -- 2.11.4.GIT