Page 1 of 1

User-agent in http header

Posted: 03 Jun 2013 15:55
by miladia
Hi,

I am trying to change HTTP header, particularly user-agent from default to something else, since the server redirect to unknown adress if VLC player is detected. I wrote the following script, but it does not work in my case, so please help, I dont know where the problem is.

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 tried to capture package and read the headers using Wireshark, the header is modified, but all options are actually removed :x

Image[/quote]

ps. You can test it by entering the stream

Re: User-agent in http header

Posted: 05 Jun 2013 15:05
by miladia
Anyone ? :(

Re: User-agent in http header

Posted: 14 Jun 2013 05:55
by NoMoreNicksLeft
I thought I saw a user-agent snippet in the appletrailers script, might want to check that. Ah, found it:

Code: Select all

table.insert( playlist, { path = urlline, name = description .. '(' .. resolution .. ')', arturl = art_url, options = {":http-user-agent=QuickTime/7.5", ":play-and-pause"} } )
I've never actually tried it though, so you might need to tinker.