Changeset 35d7e8eec7363cbe2c26c198b9726ad8d5de0690
- 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
| r0a022a6 |
r35d7e8e |
|
| 17 | 17 | -- Probe function. |
|---|
| 18 | 18 | function 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 |
|---|
| 22 | 32 | or string.match( vlc.path, "watch_fullscreen%?video_id=" ) -- the fullscreen page |
|---|
| 23 | 33 | or string.match( vlc.path, "p.swf" ) -- the (old?) player url |
|---|
| 24 | 34 | 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 |
|---|
| 27 | 36 | end |
|---|
| 28 | 37 | |
|---|
| … | … | |
| 50 | 59 | end |
|---|
| 51 | 60 | t = string.gsub( line, ".*t:'([^']*)'.*", "%1" ) |
|---|
| 52 | | vlc.msg_err( t ) |
|---|
| | 61 | -- vlc.msg_err( t ) |
|---|
| 53 | 62 | -- video_id = string.gsub( line, ".*&video_id:'([^']*)'.*", "%1" ) |
|---|
| 54 | 63 | end |
|---|
| r7297ab3 |
r35d7e8e |
|
| 5 | 5 | |
|---|
| 6 | 6 | function 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" ) ) |
|---|
| 8 | 8 | end |
|---|
| 9 | 9 | |
|---|