Streaming with http referer - please help

Rpi3b with Volumio.

I am trying to stream a radio station which looks for http referrer: Would like to know how I can add a radio stream URL with http referer on Volumio or the CLI input to get the stream playing with output to my DAC.

vlc --http-referrer=‘http://www.WEBSITE.com’ ‘http://xxx.xx.xxx.xxxx:8002/1

Yes of course. This is what the DKFM Classic stream URL looks like:
http://142.44.131.253:8013/listen.pls?sid=1&t=.pls

Thanks…

Just to be clear, I am trying to play the following stream that works on a browser window:
http://www.tamilradios.com/embed/index.php?src=http://212.47.243.160:8002/1

The server with IP is looking for a http referrer field starting with “http://www.tamilradios.com”. I would like to know how to get this type of stream playing on Volumio.

That last part is the stream URL, but it’s a private stream that needs a username and password.

Thanks. That stream URL when coupled with the http referer plays from the browser as a public stream, without any userid or password. I am just looking at a way to play it on Volumio.

Yeah, the tamilradios site must pass the authentication credentials to the stream server.
Without those credentials and knowing how to pass them in a URL that works for Volumio I think you’re stuck.

Thanks.

I just managed to install mplayer on Volumio and piped the curl output as below. The radio stream with http referer works.

curl --referer http://www.tamilradios.com http://212.47.243.160:8002/1 | mplayer -vo null -ao alsa:device=hw=2.0 -quiet -cache 2048 -

Now, if I can find a way to play this from the Volumio webUI, I can complete the set up for my friend. Any pointers on that? Thanks.

You might find some help in these topics
https://community.volumio.org/search?q=curl

@miovol Have you seen this? I was going to suggest using the ~/.curlrc file as a hack, but couldn’t get it working and came across this.

EDIT: You could spin up a simple proxy using node for this. And then use this url to with mpd.

This is just a PoC, but feel free to expand it into something more feature full!

const http = require('http');
const proxy_port = 2585;

http.createServer(onRequest).listen(proxy_port);
console.log(`Server up and listening on ${proxy_port}`)

function onRequest(client_req, client_res) {

  const options = {
    hostname: '212.47.243.160',
    port: 8002,
    path: '/1',
    method: client_req.method,
    headers: client_req.headers
  };
  // Add the required header
  options.headers.Referer = 'http://www.tamilradios.com'

  const proxy = http.request(options, function(res) {
    client_res.writeHead(res.statusCode, res.headers)
    res.pipe(client_res, {
      end: true
    });
  });

  client_req.pipe(proxy, {
    end: true
  });
}

@ashthespy

Thanks for this. I still don’t get how to get the proxy output to work with mpd. I will give it a go…

So here is something quick to get you started…

You could use it as follows:

cd ~
https://gist.githubusercontent.com/ashthespy/784394a64601b095724a724694a512d6/raw/0e7f1abb92993178129aae22d659b4affbeb7d28/volumioWebRadioProxy
chmod +x volumioWebRadioProxy
./volumioWebRadioProxy

Then add a webradio using the normal way, but point it to http://localhost:2585/tamilradios
image

If I were you, I would make this a proper service and launch it via systemd to ensure it’s always up. You could also extend the script to add other radios that require any custom stuff.

HTH,

1 Like

That really helps, @ashthespy, now I understand how to use the proxy you suggested. Thanks much.

@ashthespy, Thanks again for your time with this! Compared to using curl, this is a scalable solution where I have used the same proxy for other radio stations as well (passing parameters to the node.js script). Also it is now running as a service via systemd and usable from within LMS environment too.

Glad it worked out, If you happen to have it as a gist (and are willing to share) please do add a link, it might help someone else in the future :slight_smile: