lua: fix koreus parsing.
[vlc/asuraparaju-public.git] / share / lua / playlist / koreus.lua
blob9b0a1bf0b1bd3ecca0bc15363b6f96f71cc530f5
1 --[[
3 Copyright © 2009 the VideoLAN team
5 This program is free software; you can redistribute it and/or modify
6 it under the terms of the GNU General Public License as published by
7 the Free Software Foundation; either version 2 of the License, or
8 (at your option) any later version.
10 This program is distributed in the hope that it will be useful,
11 but WITHOUT ANY WARRANTY; without even the implied warranty of
12 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13 GNU General Public License for more details.
15 You should have received a copy of the GNU General Public License
16 along with this program; if not, write to the Free Software
17 Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston MA 02110-1301, USA.
18 --]]
20 -- Probe function.
21 function probe()
22 if vlc.access ~= "http" then
23 return false
24 end
25 koreus_site = string.match( vlc.path, "koreus" )
26 if not koreus_site then
27 return false
28 end
29 return ( string.match( vlc.path, "video" ) ) -- http://www.koreus.com/video/pouet.html
30 end
32 -- Parse function.
33 function parse()
34 while true do
35 line = vlc.readline()
36 if not line then break end
37 if string.match( line, "<meta name=\"title\"" ) then
38 _,_,name = string.find( line, "content=\"(.-)\"" )
39 end
40 if string.match( line, "<meta name=\"description\"" ) then
41 _,_,description = string.find( line, "content=\"(.-)\"" )
42 end
43 if string.match( line, "<meta name=\"author\"" ) then
44 _,_,artist = string.find( line, "content=\"(.-)\"" )
45 end
46 if string.match( line, "link rel=\"image_src\"" ) then
47 _,_,arturl = string.find( line, "href=\"(.-)\"" )
48 end
50 vid_url = string.match( line, '(http://media%d?%.koreus%.com/%d+/%d+/[%w-]*%.mp4)' )
51 if vid_url then
52 return { { path = vid_url; name = name; description = description; artist = artist; arturl = arturl } }
53 end
54 end
55 end