3 -- Copyright (C) 2012 quvi project
5 -- This file is part of libquvi-scripts <http://quvi.sourceforge.net/>.
7 -- This library is free software; you can redistribute it and/or
8 -- modify it under the terms of the GNU Lesser General Public
9 -- License as published by the Free Software Foundation; either
10 -- version 2.1 of the License, or (at your option) any later version.
12 -- This library 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 GNU
15 -- Lesser General Public License for more details.
17 -- You should have received a copy of the GNU Lesser General Public
18 -- License along with this library; if not, write to the Free Software
19 -- Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
23 -- Hundred and One Great Goals
24 local HaOgg
= {} -- Utility functions specific to this script
26 -- Identify the script.
28 package
.path
= self
.script_dir
.. '/?.lua'
29 local C
= require
'quvi/const'
31 r
.domain
= "101greatgoals%.com"
33 r
.categories
= C
.proto_http
34 local U
= require
'quvi/util'
35 r
.handles
= U
.handles(self
.page_url
, {r
.domain
}, {"/gvideos/.+"})
39 -- Query available formats.
40 function query_formats(self
)
41 self
.formats
= 'default'
42 return HaOgg
.check_external_content(self
)
47 self
.host_id
= "101greatgoals"
48 return HaOgg
.check_external_content(self
)
55 function HaOgg
.check_external_content(self
)
56 local p
= quvi
.fetch(self
.page_url
)
58 local a
= p
:match('<div id="space4para" class="post%-type%-gvideos">(.-)</div>')
59 or error("no match: article")
61 -- Self-hosted, and they use YouTube
62 -- http://www.101greatgoals.com/gvideos/golazo-wanchope-abila-sarmiento-junin-v-merlo-2/
63 if a
:match('id="jwplayer%-1%-div"') then -- get the javascript chunk for jwplayer
64 local U
= require
'quvi/util'
65 local s
= p
:match('"file":"(.-)"') or error('no match: file location')
66 a
= U
.unescape(s
):gsub("\\/", "/")
69 -- e.g. http://www.101greatgoals.com/gvideos/ea-sports-uefa-euro-2012-launch-trailer/
71 -- http://www.101greatgoals.com/gvideos/golazo-wanchope-abila-sarmiento-junin-v-merlo-2/
72 local s
= a
:match('http://.*youtube.com/embed/([^/"]+)')
73 or a
:match('http://.*youtube.com/v/([^/"]+)')
74 or a
:match('http://.*youtube.com/watch%?v=([^/"]+)')
75 or a
:match('http://.*youtu%.be/([^/"]+)')
77 self
.redirect_url
= 'http://youtube.com/watch?v=' .. s
81 -- e.g. http://www.101greatgoals.com/gvideos/leicester-1-west-ham-2/
83 -- http://www.101greatgoals.com/gvideos/golazo-alvaro-negredo-overhead-kick-puts-sevilla-1-0-up-at-getafe/
84 local s
= a
:match('http://.*dailymotion.com/embed/video/([^?"]+)')
85 or a
:match('http://.*dailymotion.com/swf/video/([^?"]+)')
87 self
.redirect_url
= 'http://dailymotion.com/video/' .. s
91 -- e.g. http://www.101greatgoals.com/gvideos/2-0-juventus-arturo-vidal-2-v-roma/
92 local s
= a
:match('http://.*videa.hu/flvplayer.swf%?v=([^?"]+)')
94 self
.redirect_url
= 'http://videa.hu/flvplayer.swf?v=' .. s
98 -- e.g. http://www.101greatgoals.com/gvideos/golazo-hulk-porto-v-benfica/
99 local s
= a
:match('http://.*sapo.pt/([^?"/]+)')
101 self
.redirect_url
= 'http://videos.sapo.pt/' .. s
105 -- FIXME rutube support missing
106 -- e.g. http://www.101greatgoals.com/gvideos/allesandro-diamanti-bologna-1-0-golazo-v-cagliari-2/
107 local s
= a
:match('http://video.rutube.ru/([^?"]+)')
109 self
.redirect_url
= 'http://video.rutube.ru/' .. s
113 -- FIXME svt.se support missing
114 -- e.g. http://www.101greatgoals.com/gvideos/gais-2-norrkoping-0/
115 local s
= a
:match('http://svt%.se/embededflash/(%d+)/play%.swf')
117 self
.redirect_url
= 'http://svt.se/embededflash/' .. s
.. '/play.swf'
121 -- FIXME lamalla.tv support missing
122 -- e.g. http://www.101greatgoals.com/gvideos/golazo-bakary-espanyol-b-vs-montanesa/
124 -- FIXME indavideo.hu support missing
125 -- e.g. http://www.101greatgoals.com/gvideos/golazo-michel-bastos-lyon-v-psg-3/
127 -- FIXME xtsream.dk support missing
128 -- e.g. http://www.101greatgoals.com/gvideos/golazo-the-ball-doesnt-hit-the-floor-viktor-claesson-elfsborg-v-fc-copenhagen-1-22-mins-in/
130 -- FIXME mslsoccer.com support missing
131 -- e.g. http://www.101greatgoals.com/gvideos/thierry-henry-back-heel-assist-mehdi-ballouchy-v-montreal-impact/
133 error("FIXME: no support: Unable to determine the media host")
136 -- vim: set ts=4 sw=4 tw=72 expandtab: