From 6844f7a51d2c1515ff4918776893cd984c14b809 Mon Sep 17 00:00:00 2001 From: Toni Gundogdu Date: Sat, 17 Mar 2012 23:28:42 +0200 Subject: [PATCH] bikeradar.lua: Use "foo:match" instead --- share/lua/website/bikeradar.lua | 24 ++++++++++-------------- 1 file changed, 10 insertions(+), 14 deletions(-) diff --git a/share/lua/website/bikeradar.lua b/share/lua/website/bikeradar.lua index 6ad7fd3..469382d 100644 --- a/share/lua/website/bikeradar.lua +++ b/share/lua/website/bikeradar.lua @@ -1,6 +1,6 @@ -- libquvi-scripts --- Copyright (C) 2011 quvi project +-- Copyright (C) 2011-2012 quvi project -- -- This file is part of libquvi-scripts . -- @@ -43,24 +43,20 @@ end function parse(self) self.host_id = "bikeradar" - local _,_,s = self.page_url:find('bikeradar.com/.+-(%d+)$') - self.id = s or error("no match: media id") + self.id = self.page_url:match('bikeradar.com/.+-(%d+)$') + or error("no match: media ID") - local page = quvi.fetch(self.page_url) + local p = quvi.fetch(self.page_url) - local _,_,s = page:find('"og:title" content="(.-)"/>') - self.title = s or error("no match: media title") + self.title = p:match('"og:title" content="(.-)"/>') + or error("no match: media title") - local _,_,s = page:find('"og:image" content="(.-)"') - self.thumbnail_url = s or '' + self.thumbnail_url = p:match('"og:image" content="(.-)"') or '' - local _,_,s = page:find('