]> git.sesse.net Git - vlc/commitdiff
lua demuxer: update googlevideo
authorRafaël Carré <funman@videolan.org>
Thu, 25 Oct 2007 23:45:08 +0000 (23:45 +0000)
committerRafaël Carré <funman@videolan.org>
Thu, 25 Oct 2007 23:45:08 +0000 (23:45 +0000)
share/luaplaylist/googlevideo.lua

index 3b9d8fc15a787a10d08fa90286d03836a8ded9b8..49ead9fa684e69eda99ac74f6c05b61a43f07144 100644 (file)
@@ -9,7 +9,17 @@ end
 
 -- Parse function.
 function parse()
-    -- We don't need to get the meta data here since it'll be available in
-    -- the GVP file.
-    return { { path = string.gsub( vlc.path, "^.*(docid=[^&]*).*$", "http://video.google.com/videogvp?%1" ) } }
+    while true
+    do
+        line = vlc.readline()
+        if not line then break end
+        if string.match( line, "^<title>" ) then
+            title = string.gsub( line, "<title>([^<]*).*", "%1" )
+        end
+        if string.match( line, "src=\"/googleplayer.swf" ) then
+            url = string.gsub( line, ".*videoUrl=([^&]*).*" ,"%1" )
+            arturl = string.gsub( line, ".*thumbnailUrl=([^\"]*).*", "%1" )
+            return { { path = vlc.decode_uri(url), title = title, arturl = vlc.decode_uri(arturl) } }
+        end
+    end
 end