Stream radio using SOCKS in a terminal

+2 votes
asked Aug 25, 2015 by berlloon

I want to listen to the online radio "tunein.com" via terminal, but there is a limitation: the website is blocked on my network, so I have to use proxy to access it.

I've set up a SOCKS 5 proxy for this purpose, but I do not know how to use it from the command line.

  1. I tried MPlayer in my terminal, but I do not know how to enable a SOCKS proxy;
    there is no setting like socks_proxy=localhost:1080
  2. This works with chainproxy on Firefox, but that requires a GUI
  3. This works with Google Chrome, but that requires a GUI

How do I use a command-line program like MPlayer to use my SOCKS proxy?

2 Answers

+2 votes
answered Aug 28, 2015 by becki

I did not find anything about socks proxy support in the documentation of mplayer.
But you can use curl to access your socks proxy and pipe the audio stream into mplayer.

The following command line plays a radio stream through a local socks5 proxy listening on port 1080:

curl --socks5 localhost:1080 http://ibizaglobalradio.streaming-pro.com:8024 | mplayer -quiet -cache 1024 -

You might experiment a bit with the cache size or not need to use the cache at all.

0 votes
answered May 6, 2016 by erik

You can use tsocks, which is a program to start other programs using a socks proxy server.

For example use this to listen to a playlist with mplayer:

tsocks mplayer -playlist http://bassdrive.com/bassdrive.m3u

The socks server I use is on port 5000 on my localhost. Therefore I’ve put the following in my /etc/tsocks.conf

server = localhost
# Server type defaults to 4 so we need to specify it as 5 for this one
server_type = 5
# The port defaults to 1080 but I've stated it here for clarity 
server_port = 5000
Welcome to Q&A, where you can ask questions and receive answers from other members of the community.
Website Online Counter

...