4 Copyright © 2007 the VideoLAN team
6 This program is free software; you can redistribute it and/or modify
7 it under the terms of the GNU General Public License as published by
8 the Free Software Foundation; either version 2 of the License, or
9 (at your option) any later version.
11 This program 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
14 GNU General Public License for more details.
16 You should have received a copy of the GNU General Public License
17 along with this program; if not, write to the Free Software
18 Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston MA 02110-1301, USA.
21 function get_url_param( url, name )
22 local _,_,ret = string.find( url, "[&?]"..name.."=([^&]*)" )
28 return vlc.access == "http"
29 and string.match( vlc.path, "video.google.com" )
30 and ( string.match( vlc.path, "videoplay" )
31 or string.match( vlc.path, "videofeed" ) )
34 function get_arg( line, arg )
35 return string.gsub( line, "^.*"..arg.."=\"(.-)\".*$", "%1" )
40 local docid = get_url_param( vlc.path, "docid" )
41 if string.match( vlc.path, "videoplay" ) then
42 return { { path = "http://video.google.com/videofeed?docid=" .. docid } }
43 elseif string.match( vlc.path, "videofeed" ) then
51 local line = vlc.readline()
52 if not line then break end
53 if string.match( line, "media:content.*flv" )
55 local _,_,s = string.find( line, "<media:content(.-)/>" )
56 path = vlc.strings.resolve_xml_special_chars(get_arg( s, "url" ))
57 duration = get_arg( s, "duration" )
59 if string.match( line, "media:thumbnail" )
61 local _,_,s = string.find( line, "<media:thumbnail(.-)/>" )
62 arturl = vlc.strings.resolve_xml_special_chars(get_arg( s, "url" ))
64 if string.match( line, "media:title" )
66 _,_,name = string.find( line, "<media:title>(.-)</media:title>" )
68 if string.match( line, "media:description" )
70 _,_,description = string.find( line, "<media:description>(.-)</media:description>" )
73 return { { path = path; name = name; arturl = arturl; duration = duration; description = description } }