1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83
|
--[[
/*
* Copyright (C) 2010 Toni Gundogdu.
*
* This file is part of quvi, see http://quvi.googlecode.com/
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
]]--
-- If you make improvements to this script, drop a line. Thanks.
-- <http://quvi.googlecode.com/>
-- Returns script details.
function ident (page_url)
-- This is what I return.
local t = {}
-- This is my domain.
t.domain = "clipfish.de"
-- This is my formats-string.
t.formats = "default"
-- This is my response to "Will you handle this URL?"
-- Note that page_url may be nil.
t.will_handle = (page_url ~= nil and page_url:find(t.domain) ~= nil)
-- Here are my details.
return t
end
-- Fetches video page and parses the video URL.
function parse (video)
-- This is my "host ID".
video.host_id = "clipfish"
-- Fetch video page.
local page = quvi.fetch(video.page_url)
-- This is my video title.
local _,_,s = page:find("<title>(.-)</title>")
video.title = s or error ("no match: video title")
-- Cleanup title.
video.title = video.title:gsub("Video:%s+", "")
video.title = video.title:gsub("%s+-%s+Clipfish", "")
-- This is my video ID.
local _,_,s = page:find("/video/(.-)/")
video.id = s or error ("no match: video id")
-- Fetch config.
local config_url =
string.format("http://www.clipfish.de/video_n.php?p=0|DE&vid=%s",
video.id)
local config = quvi.fetch(config_url, "config")
-- This is my video URL.
local _,_,s = config:find("&url=(.-)&")
video.url = {s or error ("no match: url")}
-- Return the updated video properties.
return video
end
|