Page 1 of 1

Change GET / HTTP/1.1 header

Posted: 24 May 2013 15:21
by miladia
Hi,

Is there a way to change GET http header on vlc when you want to play http streams?

GET / HTTP/1.1
Host:
User-Agent: VLC/2.0.2 LibVLC/2.0.2
Range: bytes=0-
Connection: close
Icy-MetaData: 1

I think this is default.

Re: Change GET / HTTP/1.1 header

Posted: 24 May 2013 17:04
by mederi
Probably you need to write a Lua playlist script.
viewtopic.php?f=29&t=98644

Re: Change GET / HTTP/1.1 header

Posted: 25 May 2013 01:09
by miladia
Thank you, I have tried, and modify the script:

Code: Select all

function get_prefres() local prefres = -1 if vlc.var and vlc.var.inherit then prefres = vlc.var.inherit(nil, "preferred-resolution") if prefres == nil then prefres = -1 end end return prefres end -- Probe function. function probe() return vlc.access == "http" and string.match( vlc.path, "http://best.str.nettvplus.com:8080/" ) -- do not match other addresses, -- else we'll also try to decode the actual video url end -- Parse function. function parse() agent = vlc.var.inherit(nil,"http-user-agent") if string.match( string.lower(agent), ".*vlc.*" ) then vlc.msg.dbg("Wrong agent, adapting...") return { { path = vlc.access .. "://" .. vlc.path; options = {":http-user-agent=Mozilla/5.0" } } } end end
This is the stream I would like to play in VLC stream, the problem is that if user-agent is vlc, then server will forward to some page showing error 500 (internal server error), but entering for example address into browser working without problems.

Re: Change GET / HTTP/1.1 header

Posted: 25 May 2013 13:55
by mederi
Is it the working solution or the script does not work?

Re: Change GET / HTTP/1.1 header

Posted: 25 May 2013 14:37
by miladia
Working solution. I've tried to start the script for every http stream opened in VLC. So, therefore I modified the script and probe function to be always true.

Code: Select all

-- Probe function. function probe() return vlc.access == "http" and string.match( "test", "test" ) -- return true for every http stream -- and string.match( vlc.path, "http://best.str.nettvplus.com:8080/stream/?channel=pinksi3sbb&stream=1mb&sp=nettvplus&b=10?u=WWWP4FFG&p=I2ZQV7X8" ) -- do not match other addresses, -- else we'll also try to decode the actual video url end -- Parse function. function parse() agent = vlc.var.inherit(nil,"http-user-agent") -- if string.match( string.lower(agent), ".*vlc.*" ) then -- vlc.msg.dbg("Wrong agent, adapting...") return { { path = vlc.access .. "://" .. vlc.path; options = {":http-user-agent=Mozilla/5.0" } } } end
I've previously removed other scripts, and tested with Wireshark how it is working. I have entered for example a youtube link, and the scrip is executing
main debug: TIMER module_need() : 0.975 ms - Total 0.975 ms / 1 intvls (Avg 0.975 ms)
lua debug: Path: http://www.youtube.com/watch?feature=player_embedded&v=56cQ5eCBgZo
lua debug: Option: :http-user-agent=Mozilla/5.0
main: stopping playback
main debug: deleting item `http://www.youtube.com/watch?feature=player_embedded&v=56cQ5eCBgZo'
main debug: removing module "lua"
main debug: removing module "stream_filter_record"
main debug: removing module "access_http"
main debug: incoming request - stopping current input
main debug: dead input
main debug: processing request item: http://www.youtube.com/watch?feature=player_embedded&v=56cQ5eCBgZo, node: Playlist, skip: 0
main debug: rebuilding array of current - root Playlist
main debug: rebuild done - 1 items, index 0
main debug: starting playback of the new playlist item
main debug: resyncing on http://www.youtube.com/watch?feature=player_embedded&v=56cQ5eCBgZo
main debug: http://www.youtube.com/watch?feature=player_embedded&v=56cQ5eCBgZo is at 0
main debug: creating new input thread
main debug: Creating an input for 'http://www.youtube.com/watch?feature=player_embedded&v=56cQ5eCBgZo'
main debug: no fetch required for (null) (art currently (null))
main debug: using timeshift granularity of 50 MiB, in path '/tmp'
main debug: `http://www.youtube.com/watch?feature=player_embedded&v=56cQ5eCBgZo' gives access `http' demux `' path `www.youtube.com/watch?feature=player_embedded&v=56cQ5eCBgZo'
main debug: creating demux: access='http' demux='' location='www.youtube.com/watch?feature=player_embedded&v=56cQ5eCBgZo' file='(null)'
main debug: looking for access_demux module: 0 candidates
main debug: no access_demux module matched "http"
main debug: TIMER module_need() : 0.147 ms - Total 0.147 ms / 1 intvls (Avg 0.147 ms)
main debug: creating access 'http' location='www.youtube.com/watch?feature=player_embedded&v=56cQ5eCBgZo', path='(null)'
main debug: looking for access module: 2 candidates
access_http debug: http: server='www.youtube.com' port=80 file='/watch?feature=player_embedded&v=56cQ5eCBgZo'
main debug: net: connecting to www.youtube.com port 80
main debug: TIMER input launching for 'http://www.youtube.com/watch?feature=player_embedded&v=56cQ5eCBgZo' : 422.376 ms - Total 422.376 ms / 1 intvls (Avg 422.376 ms)
main debug: connection succeeded (socket = 14)
access_http debug: protocol 'HTTP' answer code 200
access_http debug: Server: gwiseguy/2.0
access_http debug: Accepting Cookie: use_hitbox=d5c5516c3379125f43aa0d495d100d6ddAEAAAAw; path=/; domain=.youtube.com
access_http debug: Accepting Cookie: PREF=f1=40000000; path=/; domain=.youtube.com; expires=Fri, 24-Jan-2014 00:22:10 GMT
access_http debug: Accepting Cookie: recently_watched_video_id_list=13232ee9c88bcfe970ae1aec52f69b47WwEAAABzCwAAADU2Y1E1ZUNCZ1pv; path=/; domain=.youtube.com
access_http debug: Accepting Cookie: VISITOR_INFO1_LIVE=1PbZqEnSh7E; path=/; domain=.youtube.com; expires=Fri, 24-Jan-2014 00:22:10 GMT
access_http debug: Accepting Cookie: YSC=KH6L5bKUGhQ; path=/; domain=.youtube.com; httponly
access_http debug: Content-Type: text/html; charset=utf-8
access_http debug: Connection: close
main debug: using access module "access_http"
main debug: TIMER module_need() : 333.532 ms - Total 333.532 ms / 1 intvls (Avg 333.532 ms)
main debug: Using stream method for AStream*
main debug: starting pre-buffering
main debug: received first data after 0 ms
main debug: pre-buffering done 1024 bytes in 0s - 17857 KiB/s
main debug: looking for stream_filter module: 7 candidates
main debug: no stream_filter module matching "any" could be loaded
main debug: TIMER module_need() : 0.197 ms - Total 0.197 ms / 1 intvls (Avg 0.197 ms)
main debug: looking for stream_filter module: 1 candidate
main debug: using stream_filter module "stream_filter_record"
main debug: TIMER module_need() : 0.129 ms - Total 0.129 ms / 1 intvls (Avg 0.129 ms)
main debug: creating demux: access='http' demux='' location='www.youtube.com/watch?feature=player_embedded&v=56cQ5eCBgZo' file='(null)'
main debug: looking for demux module: 55 candidates
mod debug: MOD validation failed (ext=)
ts debug: TS module discarded (lost sync)
lua debug: Trying Lua scripts in /Users/aleksandarmiladinovic/Library/Application Support/org.videolan.vlc/lua/playlist
lua debug: Trying Lua scripts in /Applications/VLC.app/Contents/MacOS/share/lua/playlist
lua debug: Trying Lua playlist script /Applications/VLC.app/Contents/MacOS/share/lua/playlist/nettv.lua
lua debug: Lua playlist script /Applications/VLC.app/Contents/MacOS/share/lua/playlist/nettv.lua's probe() function was successful
Image

And of course it changed user-agent in http header. But when I tried to load my [url=http://best.str.nettvplus.com:8080/stream/?channel=pinksi3sbb&stream=1mb&sp=nettvplus&b=10?u=WWWP4FFG&p=I2ZQV7X8
]stream[/url] with the same script, it not even working, not even the probe function?!
main debug: using interface module "macosx"
main debug: TIMER module_need() : 254.869 ms - Total 254.869 ms / 1 intvls (Avg 254.869 ms)
main debug: playlist threads correctly activated
main debug: rebuilding array of current - root Playlist
main debug: rebuild done - 0 items, index -1
macosx debug: using future AR cookies
main debug: looking for services probe module: 5 candidates
main debug: no services probe module matching "any" could be loaded
main debug: TIMER module_need() : 27.281 ms - Total 27.281 ms / 1 intvls (Avg 27.281 ms)
main debug: looking for extension module: 1 candidate
lua debug: Opening Lua Extension module
lua debug: Trying Lua scripts in /Users/aleksandarmiladinovic/Library/Application Support/org.videolan.vlc/lua/extensions
lua debug: Trying Lua scripts in /Applications/VLC.app/Contents/MacOS/share/lua/extensions
lua debug: Trying Lua scripts in /Applications/VLC.app/Contents/MacOS/share/share/lua/extensions
main debug: using extension module "lua"
main debug: TIMER module_need() : 0.417 ms - Total 0.417 ms / 1 intvls (Avg 0.417 ms)
macosx debug: Found 1 capture devices
main debug: adding item `http://best.str.nettvplus.com:8080/stream/?channel=pinksi3sbb&stream=1mb&sp=nettvplus&b=10?u=WWWP4FFG&p=I2ZQV7X8
' ( http://best.str.nettvplus.com:8080/stream/?channel=pinksi3sbb&stream=1mb&sp=nettvplus&b=10?u=WWWP4FFG&p=I2ZQV7X8
)
main debug: no fetch required for (null) (art currently (null))
main debug: rebuilding array of current - root Playlist
main debug: rebuild done - 1 items, index -1
main debug: processing request item: http://best.str.nettvplus.com:8080/stream/?channel=pinksi3sbb&stream=1mb&sp=nettvplus&b=10?u=WWWP4FFG&p=I2ZQV7X8
, node: Playlist, skip: 0
main debug: resyncing on http://best.str.nettvplus.com:8080/stream/?channel=pinksi3sbb&stream=1mb&sp=nettvplus&b=10?u=WWWP4FFG&p=I2ZQV7X8

main debug: http://best.str.nettvplus.com:8080/stream/?channel=pinksi3sbb&stream=1mb&sp=nettvplus&b=10?u=WWWP4FFG&p=I2ZQV7X8
is at 0
main debug: starting playback of the new playlist item
main debug: resyncing on http://best.str.nettvplus.com:8080/stream/?channel=pinksi3sbb&stream=1mb&sp=nettvplus&b=10?u=WWWP4FFG&p=I2ZQV7X8

main debug: http://best.str.nettvplus.com:8080/stream/?channel=pinksi3sbb&stream=1mb&sp=nettvplus&b=10?u=WWWP4FFG&p=I2ZQV7X8
is at 0
main debug: creating new input thread
main debug: Creating an input for 'http://best.str.nettvplus.com:8080/stream/?channel=pinksi3sbb&stream=1mb&sp=nettvplus&b=10?u=WWWP4FFG&p=I2ZQV7X8
'
main debug: using timeshift granularity of 50 MiB, in path '/tmp'
main debug: `http://best.str.nettvplus.com:8080/stream/?channel=pinksi3sbb&stream=1mb&sp=nettvplus&b=10?u=WWWP4FFG&p=I2ZQV7X8
' gives access `http' demux `' path `best.str.nettvplus.com:8080/stream/?channel=pinksi3sbb&stream=1mb&sp=nettvplus&b=10?u=WWWP4FFG&p=I2ZQV7X8
'
main debug: creating demux: access='http' demux='' location='best.str.nettvplus.com:8080/stream/?channel=pinksi3sbb&stream=1mb&sp=nettvplus&b=10?u=WWWP4FFG&p=I2ZQV7X8
' file='(null)'
main debug: looking for access_demux module: 0 candidates
main debug: no access_demux module matched "http"
main debug: TIMER module_need() : 0.227 ms - Total 0.227 ms / 1 intvls (Avg 0.227 ms)
main debug: creating access 'http' location='best.str.nettvplus.com:8080/stream/?channel=pinksi3sbb&stream=1mb&sp=nettvplus&b=10?u=WWWP4FFG&p=I2ZQV7X8
', path='(null)'
main debug: looking for access module: 2 candidates
access_http debug: http: server='best.str.nettvplus.com' port=8080 file='/stream/?channel=pinksi3sbb&stream=1mb&sp=nettvplus&b=10?u=WWWP4FFG&p=I2ZQV7X8
'
main debug: net: connecting to best.str.nettvplus.com port 8080
main debug: connection succeeded (socket = 12)
macosx debug: no optical media found
Even the get is looking weird, without any options
Image