]> git.sesse.net Git - vlc/commitdiff
* share/luaplaylist/youtube_homepage.lua: New lua parser script to open youtube home...
authorAntoine Cellerier <dionoea@videolan.org>
Sat, 19 May 2007 00:49:30 +0000 (00:49 +0000)
committerAntoine Cellerier <dionoea@videolan.org>
Sat, 19 May 2007 00:49:30 +0000 (00:49 +0000)
share/Makefile.am
share/luaplaylist/youtube_homepage.lua [new file with mode: 0644]

index 5a4282f33370ae6db170a747c6e78213b598f1a2..b20e7ed267925e3bd604a55a91a8b5559a67d163 100644 (file)
@@ -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 (file)
index 0000000..de4df97
--- /dev/null
@@ -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[^\']*'%);\">([^<]*)</a><br/>" )
+        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