Modify user agent

Hello all,

I am having trouble with some reluctant iptv streams under OSMC. On an other Rpi with raspbian+ kodi the streams work.
The only difference I can see with wireshark is the user agent setting.
Is it possible to change the useragent somehow, or is it hardcoded in kodi?

Regards,

Bert

1 Like

This will be an add-on issue, you should raise it on the appropriate thread in the kodi forum or with the add-on developer.

Hi Gavin,

Thanks. But the problem is that the user agent is now set to “OSMC (Linux; OSMC 2016.11-1)”.
So it is definitely somewhere in OSMC (or libcurl btw) Im trying to find out where this string is defined and then change it to see if that makes a difference to the streams.

Regards,

Bert

On an other forum it was mentioned that libcurl in OSMC is out of date.
It is indeed version 7.38 from 2014. raspbian is on 7.47 by now.
@sam_nazarko: is it possible to update it to a more recent version (Mind, I have no idea what I am asking for in terms of workload, bare with me:-)

Kind regards,

Bert

Hello again,

I did a test with wget --user-agent.
The site does indeed work with the kodi user agent and not with the osmc one.
curl seems to be fine. Although an update will probably not hurt…
Hope someone can tell me where the user agent string is defined in OSMC.

Regards,

Bert

i found the patch used to set the user agent in osmc-mediacentre
@sam_nazarko would you consider reverting this patch? What is the use for this? Kodi is kodi, no?

Regards,

Bert

The user agent patch shouldn’t cause any problems.

The version of curl we use is the same version as in Debian Jessie. Raspbian is based on Debian as well, so the version will be the same, although it may be a little older as it takes time for Raspbian packages to be built downstream.

Where did you see these version numbers?
Is your system up to date?

I would only change the user agent if I saw confirmation that this was the issue. You can build Kodi pretty easily (just run make) and remove the patch from patches to build your own package

Hello Sam,

Please disregard my comment on the libcurl version.
I was sure I took the version number from a fresh raspbian pixel install, but you are absolutely right.
The version is the same: 7.38. I must have mixed up tabs in my terminal :frowning:

I agree that the user-agent shouldn’t cause problems. But in my case it does. The right way to fix it is on the service provider side. But their helpdesk reaction is of the level:“please reinstall kodi” and “It must be your ISP” and " please check your internet connection"

So my sole reasoning against the user-agent patch is that it puts the OSMC users in a separate pool from the other kodi users. if the string would be the same, more people would have had the problem and it would be more quickly solved, or even noticed on forehand.

Regarding compiling kodi, a few questions I downloaded the osmc-master.zip from github. I found the package/mediacentre-osmc directory. Do I run make from there? And will it crosscompile? Or should I run this on a Rpi? (trying that now. but it would be soo much faster on a laptop:-)
Will it create the .deb package automatically, or do I need to do something extra for that?

Regards,

Bert

Use git to clone the repo, do your changes, compile.

I think the wiki is your friend. Else, search the forum. A lot of people built kodi to test stuff.

That’s a bad response considering the price of their packages. I received your email with some demonstration that the OSMC user agent is being blocked and this seems plausible. Some further investigation is certainly necessary, and I have also highlighted why we have a separate user agent on our platform in that same email.

It will be slower on a non-native target, i.e. your laptop.

You just need to grab build-essential and git, then clone and run make. Everything will be built for you.

Hi Sam,

Thanks for your explanation. And indeed, make does magic in your build system:-)
It seems to do all in one go.
However, I seem to have run out of memory. (at least that is the indication google gave me on the below error.

g++: internal compiler error: Killed (program cc1plus)

I restarted compiling now, hoping that it the second run would require less RAM.

But any advice?

Regards,

Bert

If you have a pi1 you might need a swap file.
On others it might help to stop kodi and other unneeded services first.

Stop Kodi before building.

You can have OSMC handle your swap for building by changing:

export BUILD_OPTION_DEFAULTS=$(($BUILD_OPTION_LANGC + $BUILD_OPTION_USE_O3 + $BUILD_OPTION_USE_NOFP + $BUILD_OPTION_USE_CCACHE + $BUILD_OPTION_PREFER_LIBOSMC + $BUILD_OPTION_FASTER_APT))

to

export BUILD_OPTION_DEFAULTS=$(($BUILD_OPTION_LANGC + $BUILD_OPTION_USE_O3 + $BUILD_OPTION_USE_NOFP + $BUILD_OPTION_USE_CCACHE + $BUILD_OPTION_PREFER_LIBOSMC + $BUILD_OPTION_FASTER_APT + $BUILD_OPTION_NEEDS_SWAP))

in package/common.sh

Hello all,

I found an workaround. you can tell kodi to change the user-agent string by appending |User-agent=“blabla” to the end of the url.
So with a bit of search and replace I was able to get all channels working!

Regards,

Bert

It’s probably worth raising a ticket with them and asking why they’re blocking the OSMC user agent.

:slight_smile:
I have a ticket open with them, but the technical level of the helpdesk is not very high.
It seems to be the standard helpdesk level support: Have you rebooted your computer.
But I keep pushing.
I’ve also put it on their forum, so others can have a say in it and mention it to the helpdesk. Maybe more voices will help

But for now it works. And I have to add my security webcams to the m3u stream anyways, so I have to process the m3u file anywas. This just adds 1 line to the script.

Regards,

Bert

P.S. Holiday donation is underway. Thanks for all your great work on OSMC and have a great Christmas.

1 Like

Hi,

Did you get any further with the helpdesk? I’ve tried contacting them, but so far i’ve had no response.
I’ve been on the forums, but this thread is the best i could find on the net for our problem.I will try to push for a fix as well once i get in contact with them.

I’m also using OSMC and trying to get RapidIPTV to work, but i’m also getting 401 unauthorized.
How exactly did you add the useragent to the streams, can you show me an example of how your m3u file is set-up?

Regards,
Michael

No, the helpdesk is useless for anything beyond unblocking your IP. The response time is good though, normally. Just not technically adequate (did i say that nicely enough?)

The trick is to download the m3u file and extend all the URLS with |User-Agent=“kodi”
Or any other string that you like. As long as it doesn’t contain the string “OSMC” From what I tested, it looked like they were explicitely blocking that. (Sam, what did you do to them??)
Then you import the new m3u file in the PVR-simple client from a file, instead of URL and the rest of the setup is the same.

I can send you a script when I’m home to deal with the downloading and User-Agent part.

I’m currently fighting with tvheadend to get RapidIPTV working. I’d like to get timeshift and recording working. If you are trying that as well, lets stay in touch!

Bert

Yeah, they don’t even respond to me so i’ve pretty much given up. I’ve just changed the m3u as well, but i’m not all that satisfied with the performance on my Pi3. Also having a lot of buffering issues.

It’s good enough for the bedroom, but not as main TV solution. Not an OSMC problem though, i’m still satisfied with that :slight_smile:

Thanks for your effort though :wink:

Hi Mikkel,

The solution worked very fine on my Rp 3. I was perfectly happy with the performance of the TV side and the quality. Channel changing was snappy as well.

Seems your main problem is the internet speed. I am running the Rpi wired. I can imagine wifi would not upto it in all circumstances. On the other hand, I measured about 1Mbps for HD channels, which was much less than I had expected.

I would like to get recording and timeshifting to work though. I haven’t succeeded yet though. TVheadend is getting better at this, but not quite there yet. The new kodi 0.17 PVR-simple-client is wispered to be much more stable as well. We have to give it time to let it all mature a bit:-)

Bert