]> git.sesse.net Git - vlc/blob - share/luaplaylist/youtube_homepage.lua
* m3u.c: remove unneeded comment. ppsz_options is freed a few lines down.
[vlc] / share / luaplaylist / youtube_homepage.lua
1 function probe()
2     return vlc.access == "http" and ( string.match( vlc.path, "youtube.com/$" ) or string.match( vlc.path, "youtube.com/browse" ) )
3 end
4
5 function parse()
6     p = {}
7     while true
8     do
9         line = vlc.readline()
10         if not line then break end
11         for path, artist, name in string.gmatch( line, "href=\"(/watch%?v=[^\"]*)\" onclick=\"_hbLink%('([^']*)','Vid[^\']*'%);\">([^<]*)</a><br/>" )
12         do
13             path = "http://www.youtube.com" .. path
14             name = vlc.resolve_xml_special_chars( name )
15             table.insert( p, { path = path; name = name; artist = artist } )
16         end
17     end
18     return p
19 end