4 Copyright © 2011 the VideoLAN team
6 Authors: Konstantin Pavlov (thresh@videolan.org)
8 This program is free software; you can redistribute it and/or modify
9 it under the terms of the GNU General Public License as published by
10 the Free Software Foundation; either version 2 of the License, or
11 (at your option) any later version.
13 This program is distributed in the hope that it will be useful,
14 but WITHOUT ANY WARRANTY; without even the implied warranty of
15 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
16 GNU General Public License for more details.
18 You should have received a copy of the GNU General Public License
19 along with this program; if not, write to the Free Software
20 Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston MA 02110-1301, USA.
25 local path
= vlc
.path
:gsub("^www%.", "")
26 return vlc
.access
== "http"
27 and ( string.match( vlc
.path
, "^extreme%.com/.+" )
28 or string.match( vlc
.path
, "^freecaster%.tv/.+" )
29 or string.match( vlc
.path
, "^player%.extreme%.com/info/.+") )
34 if (string.match( vlc
.path
, "extreme%.com/." ) or string.match( vlc
.path
, "freecaster%.tv/." )) and not string.match( vlc
.path
, "player%.extreme%.com/info/") then
37 if not line
then break end
38 -- Try to find id of the video
39 if string.match( line
, "http://player.extreme.com/FCPlayer.swf" ) then
40 _
,_
,vid
= string.find( line
, "id=(.*)\"" )
44 return { { path
= "http://player.extreme.com/info/" .. vid
; name
= "extreme.com video"; } }
47 if string.match( vlc
.path
, "player%.extreme%.com/info/." ) then
48 prefres
= vlc
.var
.inherit(nil, "preferred-resolution")
52 if not line
then break end
53 -- Try to find the video's title
54 if string.match( line
, "title>(.*)<" ) then
55 _
,_
,name
= string.find( line
, "<title>(.*)<" )
58 -- Try to find image for thumbnail
59 if string.match( line
, "<path>(*.)</path>" ) then
60 _
,_
,arturl
= string.find( line
, "<path>(*.)</path>" )
63 -- Try to find out if its a freecaster streaming or just a link to some
64 -- other video streaming website
65 -- We assume freecaster now streams in http
66 if string.match( line
, "<streams type=\"5\" server=\"(.*)\">" )
68 _
,_
,videoserver
= string.find( line
, "<streams type=\"5\" server=\"(.*)\">" )
72 -- if we're going outside, we need to find out the path
74 if string.match( line
, ">(.*)</stream>" ) then
75 _
,_
,path
= string.find( line
, "bitrate=\"0\" duration=\"\">(.*)</stream>" )
79 -- and if we're using freecaster, use appropriate resolution
80 if not gostraight
then
81 if string.match( line
, "height=\"(.*)\" duration" ) then
82 _
,_
,height
= string.find( line
, "height=\"(%d+)\" duration" )
83 _
,_
,playpath
= string.find( line
, "\">(.*)</stream>" )
84 if ( prefres
< 0 or tonumber( height
) <= prefres
) then
85 path
= videoserver
.. playpath
91 return { { path
= path
; name
= name
; arturl
= arturl
} }