Changeset 35d7e8eec7363cbe2c26c198b9726ad8d5de0690

Show
Ignore:
Timestamp:
10/07/07 19:54:41 (10 months ago)
Author:
Rafaël Carré <funman@videolan.org>
git-committer:
Rafaël Carré <funman@videolan.org> 1191779681 +0000
git-parent:

[3057fada94c6c0ff2e7d0bfc149602375500c2df]

git-author:
Rafaël Carré <funman@videolan.org> 1191779681 +0000
Message:

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

Files:

Legend:

Unmodified
Added
Removed
Modified
Copied
Moved
  • share/luaplaylist/youtube.lua

    r0a022a6 r35d7e8e  
    1717-- Probe function. 
    1818function probe() 
    19     return vlc.access == "http" 
    20         and string.match( vlc.path, "youtube.com" )  
    21         and (  string.match( vlc.path, "watch%?v=" ) -- the html page 
     19    if vlc.access ~= "http" then 
     20        return false 
     21    end 
     22    youtube_site = string.match( string.sub( vlc.path, 1, 8 ), "youtube" ) 
     23    if not youtube_site then 
     24        -- FIXME we should be using a builtin list of known youtube websites 
     25        -- like "fr.youtube.com", "uk.youtube.com" etc.. 
     26        youtube_site = string.find( vlc.path, ".youtube.com" ) 
     27        if youtube_site == nil then 
     28            return false 
     29        end 
     30    end 
     31    return (  string.match( vlc.path, "watch%?v=" ) -- the html page 
    2232            or string.match( vlc.path, "watch_fullscreen%?video_id=" ) -- the fullscreen page 
    2333            or string.match( vlc.path, "p.swf" ) -- the (old?) player url 
    2434            or string.match( vlc.path, "jp.swf" ) -- the (new?) player url (as of 24/08/2007) 
    25             or string.match( vlc.path, "player2.swf" ) -- another player url 
    26             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) 
     35            or string.match( vlc.path, "player2.swf" ) ) -- another player url 
    2736end 
    2837 
     
    5059                end 
    5160                t = string.gsub( line, ".*t:'([^']*)'.*", "%1" ) 
    52                 vlc.msg_err( t ) 
     61                -- vlc.msg_err( t ) 
    5362                -- video_id = string.gsub( line, ".*&video_id:'([^']*)'.*", "%1" ) 
    5463            end 
  • share/luaplaylist/youtube_homepage.lua

    r7297ab3 r35d7e8e  
    55 
    66function probe() 
    7     return vlc.access == "http" and ( string.match( vlc.path, "youtube.com/?$" ) or string.match( vlc.path, "youtube.com/browse" ) ) 
     7    return vlc.access == "http" and ( string.match( vlc.path, "youtube.com/%?$" ) or string.match( vlc.path, "youtube.com/browse" ) ) 
    88end 
    99