3
* Copyright (C) 2010 Toni Gundogdu.
5
* This file is part of quvi, see http://quvi.googlecode.com/
7
* This program is free software: you can redistribute it and/or modify
8
* it under the terms of the GNU General Public License as published by
9
* the Free Software Foundation, either version 3 of the License, or
10
* (at your option) any later version.
12
* This program is distributed in the hope that it will be useful,
13
* but WITHOUT ANY WARRANTY; without even the implied warranty of
14
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15
* GNU General Public License for more details.
17
* You should have received a copy of the GNU General Public License
18
* along with this program. If not, see <http://www.gnu.org/licenses/>.
22
-- If you make improvements to this script, drop a line. Thanks.
23
-- <http://quvi.googlecode.com/>
25
-- Returns script details.
26
function ident (page_url)
28
-- This is what I return.
32
t.domain = "myubo.com"
34
-- This is my formats-string.
37
-- This is my response to "Will you handle this URL?"
38
-- Note that page_url may be nil.
39
t.will_handle = (page_url ~= nil and page_url:find(t.domain) ~= nil)
41
-- Here are my details.
46
-- Fetches video page and parses the video URL.
47
function parse (video)
49
-- This is my "host ID".
50
video.host_id = "myubo"
53
local page = quvi.fetch(video.page_url)
55
-- This is my video title.
56
local _,_,s = page:find('<div id="movieDetail"><h1>(.-)</')
57
video.title = s or error ("no match: video title")
59
-- This is my video ID.
60
local _,_,s = page:find('movieid=(.-)"')
61
video.id = s or error ("no match: video id")
63
-- This is my video URL.
64
local _,_,s = page:find("writeFlashPlayer%('(.-)'")
65
video.url = {s or error ("no match: writeFlashPlayer")}
67
-- Return the updated video properties.