]> git.sesse.net Git - vlc/commitdiff
* metacafe.lua: forgot the title here too.
authorAntoine Cellerier <dionoea@videolan.org>
Mon, 14 May 2007 22:37:33 +0000 (22:37 +0000)
committerAntoine Cellerier <dionoea@videolan.org>
Mon, 14 May 2007 22:37:33 +0000 (22:37 +0000)
share/luaplaylist/metacafe.lua

index 8490d9b2f953b9d11211e24a73f198b1d64a9f43..2f0e520267c3938ee26e0d6b6a7b5a0ae8a54b18 100644 (file)
@@ -12,7 +12,16 @@ end
 function parse()
     if string.match( vlc.path, "watch/" )
     then -- This is the HTML page's URL
-        return { { url = string.gsub( vlc.path, "^.*watch/(.*[^/])/?$", "http://www.metacafe.com/fplayer/%1.swf" ) } }
+        while true do
+            -- Try to find the video's title
+            line = vlc.readline()
+            if not line then break end
+            if string.match( line, "<meta name=\"title\"" ) then
+                title = string.gsub( line, "^.*content=\"([^\"]*).*$", "%1" )  
+                break
+            end
+        end
+        return { { url = string.gsub( vlc.path, "^.*watch/(.*[^/])/?$", "http://www.metacafe.com/fplayer/%1.swf" ); title = title } }
     else -- This is the flash player's URL
         return { { url = string.gsub( vlc.path, "^.*mediaURL=([^&]*).*$", "%1" ) } }
     end