[vlc-devel] [PATCH] luascripts: add pluzz.fr
Rémi Denis-Courmont
remi at remlab.net
Mon Jul 19 15:23:20 CEST 2010
Hasn't there been rulings against deep linking in France?
On Mon, 19 Jul 2010 15:16:53 +0200, Francois Cartegnie <fcvlcdev at free.fr>
wrote:
> ---
> share/Makefile.am | 2 +
> share/lua/playlist/pluzz.lua | 108
> ++++++++++++++++++++++++++++++++++++++++++
> 2 files changed, 110 insertions(+), 0 deletions(-)
> create mode 100644 share/lua/playlist/pluzz.lua
>
> diff --git a/share/Makefile.am b/share/Makefile.am
> index fe61d4b..59769b8 100644
> --- a/share/Makefile.am
> +++ b/share/Makefile.am
> @@ -248,6 +248,7 @@ nobase_vlclib_DATA = \
> lua/playlist/vimeo.luac \
> lua/playlist/youtube.luac \
> lua/playlist/youtube_homepage.luac \
> + lua/playlist/pluzz.luac \
> lua/sd/appletrailers.luac \
> lua/sd/fmc.luac \
> lua/sd/freebox.luac \
> @@ -314,6 +315,7 @@ EXTRA_DIST += \
> lua/playlist/vimeo.lua \
> lua/playlist/youtube.lua \
> lua/playlist/youtube_homepage.lua \
> + lua/playlist/pluzz.lua \
> lua/sd/README.txt \
> lua/sd/appletrailers.lua \
> lua/sd/fmc.lua \
> diff --git a/share/lua/playlist/pluzz.lua b/share/lua/playlist/pluzz.lua
> new file mode 100644
> index 0000000..d2e8516
> --- /dev/null
> +++ b/share/lua/playlist/pluzz.lua
> @@ -0,0 +1,108 @@
> +--[[
> + Extracts video URL from Pluzz.fr video pages.
> +
> + $Id$
> +
> + Copyright 2010 the VideoLAN team
> +
> + 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 2 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, write to the Free Software
> + Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston MA
02110-1301,
> USA.
> +--]]
> +
> +-- Probe function.
> +function probe()
> + return vlc.access == "http"
> + and (
> + string.match( vlc.path, "www.pluzz.fr" )
> + or
> + string.match( vlc.path, "info.francetelevisions.fr" )
> + )
> +end
> +
> +-- Parse function.
> +function parse()
> +
> +-- the video's html page
> + if string.match( vlc.path, "www.pluzz.fr" ) then
> + while true
> + do
> + line = vlc.readline()
> + if not line then break end
> +
> + if string.match( line, " id=\"current_video\" " )
> + then
> + _,_,path = string.find( line, " href=\"(.-)\" " )
> + if path then
> + vlc.msg.dbg( "redirecting to resource " .. path )
> + return { { path = "http://" .. path } }
> + else
> + vlc.msg.warn( "video resource url not found" )
> + return { }
> + end
> + end
> + end
> + end
> +
> +-- the video's second html resource file
> + if string.match( vlc.path, "info.francetelevisions.fr" ) then
> + while true
> + do
> + line = vlc.readline()
> + if not line then break end
> +
> + if string.match( line, " name=\"urls%-url%-video\" " )
> + then
> + _,_,path = string.find( line, " content=\"(.-)\"" )
> + if path then
> + path = string.gsub(path, "geoloc/", "")
> + path = "mms://videozones.francetv.fr/" .. path
> + vlc.msg.dbg( "video url found " .. path )
> + else
> + vlc.msg.warn( "video url not found" )
> + return { }
> + end
> + end
> +
> + if string.match( line, " name=\"vignette%-titre%-court\" " )
> + then
> + _,_,name = string.find( line, " content=\"(.-)\"" )
> + name = vlc.strings.resolve_xml_special_chars( name )
> + end
> +
> + if string.match( line, " name=\"description\" " )
> + then
> + _,_,description = string.find( line, " content=\"(.-)\""
)
> + description = vlc.strings.resolve_xml_special_chars(
> description )
> + end
> +
> + if string.match( line, " name=\"vignette\" " )
> + then
> + _,_,arturl = string.find( line, " content=\"(.-)\"" )
> + if arturl then
> + arturl = "http://info.francetelevisions.fr" .. arturl
> + end
> + end
> +
> + if string.match( line, " name=\"vignette%-duree\" " )
> + then
> + _,_,duration = string.find( line, " content=\"(.-)\"" )
> + end
> + end
> +
> + return { { path = path; name = name; arturl = arturl; duration =
> duration; description = description } }
> + end
> +
> + vlc.msg.warn( "video resource parsing failed" )
> + return { }
> +end
> --
> 1.6.4.4
--
Rémi Denis-Courmont
http://www.remlab.net
http://fi.linkedin.com/in/remidenis
More information about the vlc-devel
mailing list