Sending Crafted HTTP Request Header in Kodi

Some internet streams are only available from their website. Although the underlying protocol is HTTP streaming, you won’t able to play the media simply by opening the stream URL with Kodi. That is because the streaming server checks your User-Agent and Referer to ensure you’re accessing the stream with browser from certain website.

Sending crafted HTTP request header will allow you to bypass the restriction. Here is how….

Say you have a stream URL:

http://mr.lonely.love/live

For Kodi to send a specified User-Agent and Referer, you’ll have to change the URL to something like:

http://mr.lonely.love/live|User-Agent=Mozilla/5.0&Referer=http://www.lonelyplanet.com/

Note: User-Agent string and Referer string need to be modified accordingly to reflect the browser you’re using and the site you’re on.

Caveat

The modified URL won’t work if added to “Favorites” (not sure why), instead, load the URL through M3U or PLS playlist.

References

  1. HTTP – Kodi
  2. https://github.com/xbmc/xbmc/blob/master/xbmc/filesystem/CurlFile.cpp
  3. UserAgentString.com
Posted in Technical.

One Comment

  1. 這篇文章超棒
    正在開發外掛的我看到這篇文章簡直是救星
    非常謝謝高手前輩的整理!

Leave a Reply

Your email address will not be published. Required fields are marked *

Captcha loading...