User-agent in http header

Discuss your Lua playlist, album art and interface scripts.
miladia
New Cone
New Cone
Posts: 5
Joined: 23 May 2013 12:31

User-agent in http header

Postby miladia » 03 Jun 2013 15:55

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

miladia
New Cone
New Cone
Posts: 5
Joined: 23 May 2013 12:31

Re: User-agent in http header

Postby miladia » 05 Jun 2013 15:05

Anyone ? :(

NoMoreNicksLeft
Blank Cone
Blank Cone
Posts: 21
Joined: 06 Aug 2012 19:39

Re: User-agent in http header

Postby NoMoreNicksLeft » 14 Jun 2013 05:55

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.


Return to “Scripting VLC in lua”

Who is online

Users browsing this forum: No registered users and 11 guests