Kodi Community Forum
User-agent spoofing in xbmc.player().play() - Printable Version

+- Kodi Community Forum (https://forum.kodi.tv)
+-- Forum: Development (https://forum.kodi.tv/forumdisplay.php?fid=32)
+--- Forum: Add-ons (https://forum.kodi.tv/forumdisplay.php?fid=26)
+--- Thread: User-agent spoofing in xbmc.player().play() (/showthread.php?tid=14643)



- scorpion303 - 2005-08-31

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)



- pike - 2005-08-31

that user-agent is sent to "trick" shoutcast servers into letting us connect without issues.

it's defined in mplayer.conf


- m3ga - 2005-09-01

(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.


RE: User-agent spoofing in xbmc.player().play() - xbmc007 - 2013-07-14

Was the functionality ever added? Any way to pass user agent to xbmc.player().play()?


RE: User-agent spoofing in xbmc.player().play() - sphere - 2013-07-15

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).


RE: User-agent spoofing in xbmc.player().play() - xbmc007 - 2013-07-16

Thanks!


RE: User-agent spoofing in xbmc.player().play() - ololoe - 2013-07-21

(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?


RE: User-agent spoofing in xbmc.player().play() - HenryFord - 2013-07-29

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.


RE: User-agent spoofing in xbmc.player().play() - ololoe - 2013-07-29

A WORKAROUND is to append shit to url that doesn't belong there rather then supporting them via keyword arguments.


RE: User-agent spoofing in xbmc.player().play() - amet - 2013-07-29

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.


RE: User-agent spoofing in xbmc.player().play() - ololoe - 2013-07-29

(2013-07-29, 07:16)amet Wrote: as everyone on this thread is trying to help YOU
No.


RE: User-agent spoofing in xbmc.player().play() - HenryFord - 2013-07-29

Best thing to wake up to today:
ololoe
Banned


RE: User-agent spoofing in xbmc.player().play() - amet - 2013-07-29

Heh, I wonder who did it


RE: User-agent spoofing in xbmc.player().play() - Martijn - 2013-07-29

me
he has a month to cool down. see other thread where he wasn't nice
http://forum.xbmc.org/showthread.php?tid=169883&pid=1472592#pid1472592


RE: User-agent spoofing in xbmc.player().play() - amet - 2013-07-29

Yeah, didn't see that before... *sigh , I wonder why people get like that...