From e33d3f93bcd32fdd27fcf4fd063178924d6095c6 Mon Sep 17 00:00:00 2001 From: Toni Gundogdu Date: Wed, 27 Nov 2013 20:13:17 +0200 Subject: [PATCH] FIX: website/publicsenat: Reimpl. support This is a rough backport of the eb4bb860cc481 written for the 0.9 series. Notable changes: - Fetch and parse the media properties from an "emission URL" HTML - Remove support for the "idE" URLs (no apparent reason to keep) - `ident': Update URL path pattern Signed-off-by: Toni Gundogdu --- share/lua/website/publicsenat.lua | 29 ++++++++++++++++------------- 1 file changed, 16 insertions(+), 13 deletions(-) diff --git a/share/lua/website/publicsenat.lua b/share/lua/website/publicsenat.lua index 6ca0b22..403f6c3 100644 --- a/share/lua/website/publicsenat.lua +++ b/share/lua/website/publicsenat.lua @@ -1,5 +1,6 @@ -- libquvi-scripts +-- Copyright (C) 2013 Toni Gundogdu -- Copyright (C) 2010,2012 Raphaƫl Droz. -- -- This file is part of libquvi-scripts . @@ -28,7 +29,7 @@ function ident(self) r.formats = "default" r.categories = C.proto_http local U = require 'quvi/util' - r.handles = U.handles(self.page_url, {r.domain}, {"/vod"}) + r.handles = U.handles(self.page_url, {r.domain}, {"/vod/.-/%d+$"}) return r end @@ -42,24 +43,26 @@ end function parse(self) self.host_id = "publicsenat" + self.id = self.page_url:match("/vod/.-/(%d+)$") + or error('no match: media ID') + local p = quvi.fetch(self.page_url) - self.title = p:match('(.-)%s+%|') or error("no match: media title") + self.title = p:match('<title>(.-)%s+%|') + or error("no match: media title") + + local u = p:match('id="dmcloudUrlEmissionSelect" value="(.-)"') + or error('no match: emission URL') - self.id = self.page_url:match(".-idE=(%d+)$") - or self.page_url:match(".-/(%d+)$") - or error("no match: media ID") + local e = quvi.fetch(u, {fetch_type='config'}) - local t = p:match('id="imgEmissionSelect" value="(.-)"') or '' - if #t >0 then - self.thumbnail_url = 'http://publicsenat.fr' .. t - end + local d = e:match('info = (.-);') + or error('no match: info') - local u = "http://videos.publicsenat.fr/vodiFrame.php?idE=" ..self.id - local c = quvi.fetch(u, {fetch_type='config'}) + self.thumbnail_url = d:match('"thumbnail_url": "(.-)"') or '' - self.url = {c:match('id="flvEmissionSelect" value="(.-)"') - or error("no match: media stream URL")} + self.url = {d:match('"mp4_url": "(.-)"') + or error('no match: media stream URL')} return self end -- 2.11.4.GIT