Commit 35d7e8ee authored by Rafaël Carré's avatar Rafaël Carré

fix youtube lua probing, avoid infinite loops

homepage: use %? to represent '?'
other: probe is not successfull anymore for urls like http://10.0.0.1/get_video?xxxx&origin=youtube.com
parent 3057fada
...@@ -16,14 +16,23 @@ end ...@@ -16,14 +16,23 @@ end
-- Probe function. -- Probe function.
function probe() function probe()
return vlc.access == "http" if vlc.access ~= "http" then
and string.match( vlc.path, "youtube.com" ) return false
and ( string.match( vlc.path, "watch%?v=" ) -- the html page end
youtube_site = string.match( string.sub( vlc.path, 1, 8 ), "youtube" )
if not youtube_site then
-- FIXME we should be using a builtin list of known youtube websites
-- like "fr.youtube.com", "uk.youtube.com" etc..
youtube_site = string.find( vlc.path, ".youtube.com" )
if youtube_site == nil then
return false
end
end
return ( string.match( vlc.path, "watch%?v=" ) -- the html page
or string.match( vlc.path, "watch_fullscreen%?video_id=" ) -- the fullscreen page or string.match( vlc.path, "watch_fullscreen%?video_id=" ) -- the fullscreen page
or string.match( vlc.path, "p.swf" ) -- the (old?) player url or string.match( vlc.path, "p.swf" ) -- the (old?) player url
or string.match( vlc.path, "jp.swf" ) -- the (new?) player url (as of 24/08/2007) or string.match( vlc.path, "jp.swf" ) -- the (new?) player url (as of 24/08/2007)
or string.match( vlc.path, "player2.swf" ) -- another player url or string.match( vlc.path, "player2.swf" ) ) -- another player url
or ( string.match( vlc.path, "get_video%?video_id=" ) and not string.match( vlc.path, "t=" ) ) ) -- the video url without the t= parameter which is mandatory (since 24/08/2007)
end end
-- Parse function. -- Parse function.
...@@ -49,7 +58,7 @@ function parse() ...@@ -49,7 +58,7 @@ function parse()
base_yt_url = string.gsub( line, ".*BASE_YT_URL:'([^']*)'.*", "%1" ) base_yt_url = string.gsub( line, ".*BASE_YT_URL:'([^']*)'.*", "%1" )
end end
t = string.gsub( line, ".*t:'([^']*)'.*", "%1" ) t = string.gsub( line, ".*t:'([^']*)'.*", "%1" )
vlc.msg_err( t ) -- vlc.msg_err( t )
-- video_id = string.gsub( line, ".*&video_id:'([^']*)'.*", "%1" ) -- video_id = string.gsub( line, ".*&video_id:'([^']*)'.*", "%1" )
end end
if name and description and artist --[[and video_id]] then break end if name and description and artist --[[and video_id]] then break end
......
...@@ -4,7 +4,7 @@ ...@@ -4,7 +4,7 @@
--]] --]]
function probe() function probe()
return vlc.access == "http" and ( string.match( vlc.path, "youtube.com/?$" ) or string.match( vlc.path, "youtube.com/browse" ) ) return vlc.access == "http" and ( string.match( vlc.path, "youtube.com/%?$" ) or string.match( vlc.path, "youtube.com/browse" ) )
end end
function parse() function parse()
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment