From 136c5a795f12451f171f7fbb64672b60121e4b89 Mon Sep 17 00:00:00 2001 From: Packit Service Date: Dec 09 2020 20:10:31 +0000 Subject: Prepare for a new update Reverting patches so we can apply the latest update and changes can be seen in the spec file and sources. --- diff --git a/share/media/guardian.lua b/share/media/guardian.lua index 7435204..454971c 100644 --- a/share/media/guardian.lua +++ b/share/media/guardian.lua @@ -35,17 +35,13 @@ function parse(qargs) qargs.duration_ms = Guardian.parse_duration(p) qargs.title = (p:match('"og:title" content="(.-)"') or '') - qargs.title = qargs.title:gsub('%s+%-%s+video','') - qargs.title = qargs.title:gsub('%s+%–%s+video','') - - -- FIXME this should be more generic - qargs.title = qargs.title:gsub(''', "'") + :gsub('%s+%-%s+video','') qargs.id = (p:match('prop8%s+=%s+["\'](.-)["\']') or '') :match('(%d+)') or '' - qargs.thumb_url = p:match('"og:image" content="(.-)"') - or p:match('"thumbnail" content="(.-)"') or '' + qargs.thumb_url = p:match('"thumbnail" content="(.-)"') + or p:match('"og:image" content="(.-)"') or '' qargs.streams = Guardian.iter_streams(p) @@ -79,7 +75,7 @@ function Guardian.fetch(qargs) end function Guardian.iter_streams(p) - local u = p:match('&file=(.-)&poster') + local u = p:match("%s+file.-:%s+'(.-)'") or error('no match: media stream URL') local S = require 'quvi/stream' local s = S.stream_new(u) @@ -90,13 +86,9 @@ end function Guardian.parse_duration(p) local n = tonumber(p:match('duration%:%s+"?(%d+)"?') or 0) * 1000 - if n == 0 then + if n ==0 then local m,s = p:match('T(%d+)M(%d+)S') - n = ((tonumber(m) or 0) *60 + (tonumber(s) or 0)) * 1000 - end - if n == 0 then - local s = p:match('content="PT(%d+)S"') - n = (tonumber(s) or 0) * 1000 + n = (tonumber(m)*60 + tonumber(s)) * 1000 end return n end