2 Translate MegaVideo video webpages URLs to the corresponding FLV URL.
6 Copyright © 2008 the VideoLAN team
8 This program is free software; you can redistribute it and/or modify
9 it under the terms of the GNU General Public License as published by
10 the Free Software Foundation; either version 2 of the License, or
11 (at your option) any later version.
13 This program is distributed in the hope that it will be useful,
14 but WITHOUT ANY WARRANTY; without even the implied warranty of
15 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
16 GNU General Public License for more details.
18 You should have received a copy of the GNU General Public License
19 along with this program; if not, write to the Free Software
20 Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston MA 02110-1301, USA.
25 return vlc.access == "http"
26 and string.match( vlc.path, "megavideo.com" )
32 -- we have to get the xml
33 if string.match( vlc.path, "www.megavideo.com.*&v=.*&u=.*" ) then
34 id = string.gsub( vlc.path, "www.megavideo.com.*v=([^&]*).*$", "%1" )
35 path = "http://www.megavideo.com/xml/videolink.php?v=" .. id
36 return { { path = path } }
42 if not line then break end
45 if string.match( line, "<ROWS><ROW url=\"" )
49 -- buffer the full xml
53 -- now gets the encoded url
54 s = string.gsub( xml, ".*ROW url=\"([^\"]*).*", "%1" )
60 if c < 16 and c > 3 then key = 61
61 elseif c < 96 and c > 67 then key = 189
62 elseif c < 20 and c > 6 then key = 65
63 else vlc.msg_err("Oops, please report URL to developers")
66 if c < 16 and c > 3 then key = 65
67 elseif c < 96 and c > 67 then key = 193
68 elseif c < 20 and c > 6 then key = 65
69 else vlc.msg_err("Oops, please report URL to developers")
73 path = path .. string.char(key - c)
76 if path then break end
80 return { { path = path } }