2 -- Copyright (C) 2010-2012 Toni Gundogdu <legatvs@gmail.com>
4 -- This file is part of libquvi-scripts <http://quvi.sourceforge.net/>.
6 -- This library is free software; you can redistribute it and/or
7 -- modify it under the terms of the GNU Lesser General Public
8 -- License as published by the Free Software Foundation; either
9 -- version 2.1 of the License, or (at your option) any later version.
11 -- This library is distributed in the hope that it will be useful,
12 -- but WITHOUT ANY WARRANTY; without even the implied warranty of
13 -- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
14 -- Lesser General Public License for more details.
16 -- You should have received a copy of the GNU Lesser General Public
17 -- License along with this library; if not, write to the Free Software
18 -- Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
22 local Gaskrank
= {} -- Utility functions unique to this script
24 -- Identify the media script.
27 can_parse_url
= Gaskrank
.can_parse_url(qargs
),
28 domains
= table.concat({'gaskrank.tv'}, ',')
32 -- Parse media properties.
34 local p
= quvi
.fetch(qargs
.input_url
)
36 qargs
.thumb_url
= p
:match('"og:image" content="(.-)"') or ''
38 qargs
.title
= p
:match('"og:title" content="(.-)"') or ''
40 qargs
.streams
= Gaskrank
.iter_streams(p
)
42 qargs
.id
= qargs
.streams
[1].url
:match("/%d+/(%d+)%.%w+") or ''
51 function Gaskrank
.can_parse_url(qargs
)
52 local U
= require
'socket.url'
53 local t
= U
.parse(qargs
.input_url
)
54 if t
and t
.scheme
and t
.scheme
:lower():match('^http$')
55 and t
.host
and t
.host
:lower():match('gaskrank%.tv$')
56 and t
.path
and t
.path
:lower():match('^/tv/')
64 function Gaskrank
.iter_streams(p
)
65 local u
= p
:match("(http://movies.-%.flv)")
66 or error("no match: media stream URL")
67 local S
= require
'quvi/stream'
68 return {S
.stream_new(u
)}
71 -- vim: set ts=2 sw=2 tw=72 expandtab: