[vlc-devel] commit: Lua: youtube in HQ (when used with &fmt=18) (Jean-Philippe Andre )

git version control git at videolan.org
Sat Dec 6 18:53:16 CET 2008


vlc | branch: master | Jean-Philippe Andre <jpeg at via.ecp.fr> | Sat Dec  6 18:51:01 2008 +0100| [085a86595102e2a992071e9c7996f0be4c5d94b0] | committer: Jean-Philippe Andre 

Lua: youtube in HQ (when used with &fmt=18)

> http://git.videolan.org/gitweb.cgi/vlc.git/?a=commit;h=085a86595102e2a992071e9c7996f0be4c5d94b0
---

 share/lua/playlist/youtube.lua |   17 +++++++++++++++--
 1 files changed, 15 insertions(+), 2 deletions(-)

diff --git a/share/lua/playlist/youtube.lua b/share/lua/playlist/youtube.lua
index 204b7ae..452400f 100644
--- a/share/lua/playlist/youtube.lua
+++ b/share/lua/playlist/youtube.lua
@@ -91,8 +91,15 @@ function parse()
             base_yt_url = "http://youtube.com/"
         end
         arturl = get_arturl( vlc.path, video_id )
+        -- fmt is the format of the video: 18 is HQ (mp4)
+        fmt = get_url_param( vlc.path, "fmt" )
+        if fmt then
+            format = "&fmt=" .. fmt
+        else
+            format = ""
+        end
         if t then
-            return { { path = base_yt_url .. "get_video?video_id="..video_id.."&t="..t; name = name; description = description; artist = artist; arturl = arturl } }
+            return { { path = base_yt_url .. "get_video?video_id="..video_id.."&t="..t..format; name = name; description = description; artist = artist; arturl = arturl } }
         else
             -- This shouldn't happen ... but keep it as a backup.
             return { { path = "http://www.youtube.com/v/"..video_id; name = name; description = description; artist = artist; arturl = arturl } }
@@ -103,11 +110,17 @@ function parse()
         end
         video_id = get_url_param( vlc.path, "video_id" )
         arturl = get_arturl( vlc.path, video_id )
+        fmt = get_url_param( vlc.path, "fmt" )
+        if fmt then
+            format = "&fmt=" .. fmt
+        else
+            format = ""
+        end
         if not string.match( vlc.path, "t=" ) then
             -- This sucks, we're missing "t" which is now mandatory. Let's
             -- try using another url
             return { { path = "http://www.youtube.com/v/"..video_id; name = name; arturl = arturl } }
         end
-        return { { path = "http://www.youtube.com/get_video.php?video_id="..video_id.."&t="..get_url_param( vlc.path, "t" ); name = name; arturl = arturl } }
+        return { { path = "http://www.youtube.com/get_video.php?video_id="..video_id.."&t="..get_url_param( vlc.path, "t" )..format; name = name; arturl = arturl } }
     end
 end




More information about the vlc-devel mailing list