User-agent spoofing in xbmc.player().play()
#1
when i stream a file through xbmc using the xbmc.player().play("[url]http://38.39.23.24/stream/stream.asx"[/url]) method.. it always sends 'xbmc-mplayer/1.1.0(mpeg)' as the user-agent to the webserver, and the get-requests looks like this in the webserver-logs:
Quote:38.39.23.23 - user1 [30/aug/2005:22:39:21 +0100] "get /streams/stream.asx http/1.0" 200 143088 "-" "[b]xbmc-mplayer/1.1.0(mpeg)[/b]"

is there any possibility to spoof this user-agent, so the webserver sees an windows media player request?

this seems to be possible for normal url-gets (like in the following examle). does anyone know if this works for streams too?

Quote:urldata = none
urlheaders = {

'user-agent': 'mozilla/4.0 (compatible; msie 6.0; windows nt 5.1; sv1; .net clr 1.1.4322)',

'accept-language': 'en-us',

}
urllib.urlopen(url,urldata, urlheaders)
#2
that user-agent is sent to "trick" shoutcast servers into letting us connect without issues.

it's defined in mplayer.conf
Always read the XBMC online-manual, FAQ and search the forum before posting.
Do not e-mail XBMC-Team members directly asking for support. Read/follow the forum rules.
For troubleshooting and bug reporting please make sure you read this first.


Image
#3
(pike @ aug. 31 2005,15:18 Wrote:that user-agent is sent to "trick" shoutcast servers into letting us connect without issues.

it's defined in mplayer.conf
he wants to look the dutch big brother streams. the server looks at the user agent. if its not windows media player the stream will be of much lower quality. so he needs to spoof the user agent.
#4
Was the functionality ever added? Any way to pass user agent to xbmc.player().play()?
#5
It is already possible to send the user-agent, my Apple iTunes Trailers Add-on does so. Have a look to the code.

Just add
Code:
|User-Agent=Foo%20Bar
to the play URL.
So
Code:
http://www.server.com/path/to/file?param=value&param2=value2
becomes
Code:
http://www.server.com/path/to/file?param=value&param2=value2|User-Agent=Whatever%20you%20like

Btw, this works for all Headers (e.g. Cookie).
My GitHub. My Add-ons:
Image
#6
Thanks!
#7
(2013-07-15, 14:35)sphere Wrote: Just add
Code:
|User-Agent=Foo%20Bar
to the play URL.
So
Code:
http://www.server.com/path/to/file?param=value&param2=value2
becomes
Code:
http://www.server.com/path/to/file?param=value&param2=value2|User-Agent=Whatever%20you%20like

Btw, this works for all Headers (e.g. Cookie).
This looks awful. Typical WORKAROUND. Is | allowed in urls?
#8
Of course it is*

* = Of course meaning that you're dealing with an unsafe character here and they need to be/should be encoded...
However - is the pipe actually part of the URL? Way I understood it, it is a direct header modifier and not actually part of the URL.
Need help? Check out my XBMC Frodo Guide. It contains full featured guides to Sickbeard and CouchPotato as well.

Image
#9
A WORKAROUND is to append shit to url that doesn't belong there rather then supporting them via keyword arguments.
#10
I suggest you modify your attitude as everyone on this thread is trying to help YOU, if you don't like the way things are done you are welcome to fix it and suggest we pull it into mainline using PR system on github.
#11
(2013-07-29, 07:16)amet Wrote: as everyone on this thread is trying to help YOU
No.
#12
Best thing to wake up to today:
ololoe
Banned
Need help? Check out my XBMC Frodo Guide. It contains full featured guides to Sickbeard and CouchPotato as well.

Image
#13
Heh, I wonder who did it
#14
me
he has a month to cool down. see other thread where he wasn't nice
http://forum.xbmc.org/showthread.php?tid...pid1472592
Read/follow the forum rules.
For troubleshooting and bug reporting, read this first
Interested in seeing some YouTube videos about Kodi? Go here and subscribe
#15
Yeah, didn't see that before... *sigh , I wonder why people get like that...

Logout Mark Read Team Forum Stats Members Help
User-agent spoofing in xbmc.player().play()0