From 41697f25906bb631d5689a7cbb9053d597485d34 Mon Sep 17 00:00:00 2001 From: Antoine Cellerier Date: Sat, 19 May 2007 00:49:30 +0000 Subject: [PATCH] * share/luaplaylist/youtube_homepage.lua: New lua parser script to open youtube home/browse pages. This demos the ability to return more than one item in lua playlist scripts. --- share/Makefile.am | 1 + share/luaplaylist/youtube_homepage.lua | 19 +++++++++++++++++++ 2 files changed, 20 insertions(+) create mode 100644 share/luaplaylist/youtube_homepage.lua diff --git a/share/Makefile.am b/share/Makefile.am index 5a4282f333..b20e7ed267 100644 --- a/share/Makefile.am +++ b/share/Makefile.am @@ -238,5 +238,6 @@ DIST_lua= \ luaplaylist/README.txt \ luaplaylist/dailymotion.lua \ luaplaylist/youtube.lua \ + luaplaylist/youtube_homepage.lua \ luaplaylist/metacafe.lua \ luaplaylist/googlevideo.lua diff --git a/share/luaplaylist/youtube_homepage.lua b/share/luaplaylist/youtube_homepage.lua new file mode 100644 index 0000000000..de4df97a58 --- /dev/null +++ b/share/luaplaylist/youtube_homepage.lua @@ -0,0 +1,19 @@ +function probe() + return vlc.access == "http" and ( string.match( vlc.path, "youtube.com/$" ) or string.match( vlc.path, "youtube.com/browse" ) ) +end + +function parse() + p = {} + while true + do + line = vlc.readline() + if not line then break end + for path, artist, name in string.gmatch( line, "href=\"(/watch%?v=[^\"]*)\" onclick=\"_hbLink%('([^']*)','Vid[^\']*'%);\">([^<]*)
" ) + do + path = "http://www.youtube.com" .. path + name = vlc.resolve_xml_special_chars( name ) + table.insert( p, { path = path; name = name; artist = artist } ) + end + end + return p +end -- 2.39.2