2

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?

Adam Katz
  • 14,455
  • 5
  • 68
  • 83
berlloon
  • 41
  • 6
  • I couldn't figure out what "chainproxy" is, but it might actually refer to [proxychains](http://proxychains.sourceforge.net/), which appears to have more recent work on Github as [haad/proxychains](https://github.com/haad/proxychains). – Adam Katz Jul 28 '16 at 01:34

2 Answers2

3

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.

becki
  • 46
  • 1
  • Thanks! It works. And how can I specify the radio station like CNN or BBC and so on? Or this is impossible in this way? – berlloon Aug 31 '15 at 09:08
1

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
erik
  • 2,278
  • 1
  • 23
  • 30
  • This does not appear to work for either `mplayer` or `mpv`, but the other answer does. Something about how that codebase accesses the network prevents libtsocks from properly passing it along. – Adam Katz Jul 28 '16 at 00:58
  • Yes, it just works. Which version of tsocks and mplayer are you using? – erik Nov 13 '16 at 02:48