]> git.sesse.net Git - vlc/commitdiff
Fixes youtube parsing
authorRafaël Carré <funman@videolan.org>
Sat, 18 Aug 2007 00:57:17 +0000 (00:57 +0000)
committerRafaël Carré <funman@videolan.org>
Sat, 18 Aug 2007 00:57:17 +0000 (00:57 +0000)
share/luaplaylist/youtube.lua

index 14f0c1de638e74138a71cdb19cd80645fb2c52a5..b8e9ee451d8dcb7b09b5e12190bef945d9e40b99 100644 (file)
@@ -32,9 +32,12 @@ function parse()
             if string.match( line, "subscribe_to_user=" ) then
                 artist = string.gsub( line, ".*subscribe_to_user=([^&]*).*", "%1" )
             end
-            if name and description and artist then break end
+            if string.match( line, "player2.swf" ) then
+                video_id = string.gsub( line, ".*BASE_YT_URL=http://youtube.com/&video_id=([^\"]*).*", "%1" )
+            end
+            if name and description and artist and video_id then break end
         end
-        return { { path = string.gsub( vlc.path, "^(.*)watch%?v=([^&]*).*$", "http://%1v/%2" ); name = name; description = description; artist = artist } }
+        return { { path = "http://www.youtube.com/get_video.php?video_id="..video_id; name = name; description = description; artist = artist } }
     else -- This is the flash player's URL
         if string.match( vlc.path, "title=" ) then
             name = get_url_param( vlc.path, "title" )