From: Toni Gundogdu Date: Thu, 31 Jan 2013 13:01:13 +0000 (+0200) Subject: FIX: lego.lua: All patterns X-Git-Tag: v0.4.11~2^2~12 X-Git-Url: https://repo.or.cz/w/libquvi-scripts.git/commitdiff_plain/787be3d9089c54a24d6fb7b28b74bec823190c4d FIX: lego.lua: All patterns Modify the script to extract the media properties using new patterns. Signed-off-by: Toni Gundogdu --- diff --git a/share/lua/website/lego.lua b/share/lua/website/lego.lua index 5c2fe43..571e179 100644 --- a/share/lua/website/lego.lua +++ b/share/lua/website/lego.lua @@ -1,5 +1,6 @@ -- libquvi-scripts +-- Copyright (C) 2013 Toni Gundogdu -- Copyright (C) 2012 Ross Burton -- -- This file is part of libquvi-scripts . @@ -29,7 +30,8 @@ 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}, {"/.+/Movies/.+$"}) + r.handles = U.handles(self.page_url, {r.domain}, {"/.+/movies/.+$"}) + -- http://city.lego.com/en-gb/movies/mini-movies/gold-run/ return r end @@ -42,19 +44,22 @@ end -- Parse video URL. function parse(self) self.host_id = "lego" + local p = quvi.fetch(self.page_url) - local s = p:match('(.+)') - or error("no match: tracking name") - local index = s:find("-") + local d = p:match('FirstVideoData = {(.-)};') + or error('no match: FirstVideoData') + + self.title = d:match('"Name":"(.-)"') + or error('no match: media title') - self.title = s:sub(0, index-1) - self.id = s:sub(index+1) + self.id = d:match('"LikeObjectGuid":"(.-)"') -- Lack of a better. + or error('no match: media ID') - -- TODO self.thumbnail_url + self.url = {d:match('"VideoFlash":%{"Url":"(.-)"') + or error('no match: media stream URL')} - self.url = {p:match('(.+)') - or error("no match: media stream URL")} + -- TODO: return self.thumbnail_url return self end