2 -- Copyright (C) 2012,2013 Toni Gundogdu <legatvs@gmail.com>
3 -- Copyright (C) 2010 Paul Kocialkowski <contact@paulk.fr>
5 -- This file is part of libquvi-scripts <http://quvi.sourceforge.net/>.
7 -- This program is free software: you can redistribute it and/or
8 -- modify it under the terms of the GNU Affero General Public
9 -- License as published by the Free Software Foundation, either
10 -- version 3 of the License, or (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 Affero General Public License for more details.
17 -- You should have received a copy of the GNU Affero General
18 -- Public License along with this program. If not, see
19 -- <http://www.gnu.org/licenses/>.
22 local Tagtele
= {} -- Utility functions unique to this script
24 -- Identify the media script.
27 can_parse_url
= Tagtele
.can_parse_url(qargs
),
28 domains
= table.concat({'tagtele.com'}, ',')
34 self
.host_id
= "tagtele"
36 local p
= quvi
.fetch(self
.page_url
)
38 self
.title
= p
:match("<title>TagTélé%s+-%s+(.-)</title>")
39 or error("no match: media title")
41 self
.id
= self
.page_url
:match('/voir/(%d+)')
42 or error("no match: media ID")
44 local pl_url
= "http://www.tagtele.com/videos/playlist/"..self
.id
.."/"
45 local pl
= quvi
.fetch(pl_url
, {fetch_type
='playlist'})
47 self
.url
= {pl
:match("<location>(.-)</")
48 or error("no match: media URL")}
57 function Tagtele
.can_parse_url(qargs
)
58 local U
= require
'socket.url'
59 local t
= U
.parse(qargs
.input_url
)
60 if t
and t
.scheme
and t
.scheme
:lower():match('^https?$')
61 and t
.host
and t
.host
:lower():match('^www%.tagtele%.com$')
62 and t
.path
and t
.path
:lower():match('^/videos/voir/%d+/$')
70 -- vim: set ts=4 sw=4 tw=72 expandtab: