[vlc-commits] commit: lua: update youtube script to support "html5=True" URLs ( Pierre Ynard )

git at videolan.org git at videolan.org
Wed May 26 20:01:21 CEST 2010


vlc/vlc-1.1 | branch: master | Pierre Ynard <linkfanel at yahoo.fr> | Wed May 26 19:46:45 2010 +0200| [8ccbd50e618d3223db26faf1e3b236c7390c09a5] | committer: Pierre Ynard 

lua: update youtube script to support "html5=True" URLs

Sorry for last commit which was a little retarded
(cherry picked from commit 865a279f05af298d19e23aa75fafd012b0106e6f)

Signed-off-by: Pierre Ynard <linkfanel at yahoo.fr>

> http://git.videolan.org/gitweb.cgi/vlc/vlc-1.1.git/?a=commit;h=8ccbd50e618d3223db26faf1e3b236c7390c09a5
---

 share/lua/playlist/youtube.lua |    9 +++++----
 1 files changed, 5 insertions(+), 4 deletions(-)

diff --git a/share/lua/playlist/youtube.lua b/share/lua/playlist/youtube.lua
index 11f01fb..8823925 100644
--- a/share/lua/playlist/youtube.lua
+++ b/share/lua/playlist/youtube.lua
@@ -73,19 +73,20 @@ function parse()
             if string.match( line, "subscribe_to_user=" ) then
                 _,_,artist = string.find( line, "subscribe_to_user=([^&]*)" )
             end
-            -- CURRENT: var swfHTML = (isIE) ? "<object [...]><param name=\"flashvars\" value=\"rv.2.thumbnailUrl=http%3A%2F%2Fi4.ytimg.com%2Fvi%2F3MLp7YNTznE%2Fdefault.jpg&rv.7.length_seconds=384 [...] &video_id=OHVvVmUNBFc [...] &t=OEgsToPDskK3zO44y0QN8Fr5ZSAZwCQp [...]
-            if string.match( line, "swfHTML" ) and string.match( line, "video_id" ) then
-                _,_,t = string.find( line, "&t=(.-)&" )
+            -- CURRENT: var swfConfig = { [a lot of stuff...], "video_id": "OHVvVmUNBFc", "sk": "WswKuJzDBsdD6oG3IakCXgC", "t": "OEgsToPDskK3zO44y0QN8Fr5ZSAZwCQp", "plid": "AARGnwWMrmGkbpOxAAAA4AT4IAA"};
             -- OLD 1: var swfArgs = {hl:'en',BASE_YT_URL:'http://youtube.com/',video_id:'XPJ7d8dq0t8',l:'292',t:'OEgsToPDskLFdOYrrlDm3FQPoQBYaCP1',sk:'0gnr-AE6QZJEZmCMd3lq_AC'};
             -- OLD 2: var swfArgs = { "BASE_YT_URL": "http://youtube.com", "video_id": "OHVvVmUNBFc", "l": 88, "sk": "WswKuJzDBsdD6oG3IakCXgC", "t": "OEgsToPDskK3zO44y0QN8Fr5ZSAZwCQp", "plid": "AARGnwWMrmGkbpOxAAAA4AT4IAA", "tk": "mEL4E7PqHeaZp5OG19NQThHt9mXJU4PbRTOw6lz9osHi4Hixp7RE1w=="};
             -- OLD 3: 'SWF_ARGS': { [a lot of stuff...], "video_id": "OHVvVmUNBFc", "sk": "WswKuJzDBsdD6oG3IakCXgC", "t": "OEgsToPDskK3zO44y0QN8Fr5ZSAZwCQp", "plid": "AARGnwWMrmGkbpOxAAAA4AT4IAA"};
-            elseif ( string.match( line, "SWF_ARGS" ) or string.match( line, "swfArgs" ) ) and string.match( line, "video_id" ) then
+            if ( string.match( line, "swfConfig" ) or string.match( line, "SWF_ARGS" ) or string.match( line, "swfArgs" ) ) and string.match( line, "video_id" ) then
                 if string.match( line, "BASE_YT_URL" ) then
                     _,_,base_yt_url = string.find( line, "\"BASE_YT_URL\": \"(.-)\"" )
                 end
                 _,_,t = string.find( line, "\"t\": \"(.-)\"" )
                 -- vlc.msg.err( t )
                 -- video_id = string.gsub( line, ".*&video_id:'([^']*)'.*", "%1" )
+            -- Also available on non-HTML5 pages: var swfHTML = (isIE) ? "<object [...]><param name=\"flashvars\" value=\"rv.2.thumbnailUrl=http%3A%2F%2Fi4.ytimg.com%2Fvi%2F3MLp7YNTznE%2Fdefault.jpg&rv.7.length_seconds=384 [...] &video_id=OHVvVmUNBFc [...] &t=OEgsToPDskK3zO44y0QN8Fr5ZSAZwCQp [...]
+            elseif string.match( line, "swfHTML" ) and string.match( line, "video_id" ) then
+                _,_,t = string.find( line, "&t=(.-)&" )
             end
             if name and description and artist --[[and video_id]] then break end
         end



More information about the vlc-commits mailing list