Monday 21 March 2016

Listen to DI.FM streams with VLC as a "Free Listener" (March 2016)

As a long time  DI.FM  listener I remember the days when tuning into streams with  Winamp  was just how you listened.* Of course as time has gone on  VLC  has become dominant for streaming media, especially since it is OSS and works on practically every platform.

*(This has its connections to  Icecast  which uses the  SHOUTcast  protocol, SHOUTcast being by  NullSoft  which of course made/owned... Winamp.)



So, not too long ago DI.FM started changing things and they didn't share stream URLs very freely. But it wasn't hard to find their  http://pub#.di.fm  (where # is an integer between 1 and ...?) Icecast listings. Paste the link with the mount-point of your choice in VLC or w/e and there you go!

Well the PUBlic listings are still up (minus pub3  ??) but when you tune in you get a canned message about "copyright" this and "PRO account" that...

But hey, I signed up to DI.FM's site. I am a "Free Listener", I hear all the ads, probably don't get the best steam quality, sure. So why can't I just listen on VLC?! ;_;

Well, as it turns out it isn't even as difficult as using your "listener key" or w/e you get when you login to their site. (which is weird because when the site is making all the stream requests it includes your "id/key" as a querystring to the server and even sends all your cookie data along too.)

All the public servers are looking for now is:
  • A valid Browser User-Agent
  • That  http://www.di.fm/  is the referring page


Poor Man's Method (cURL)



  • Pipes cURL putput directly to VLC
  • I have VLC_BIN as an example for pointing to the VLC app on OSX
  • `vlc -`  the dash means "read from STDIN"
    • https://wiki.videolan.org/Uncommon_uses/


    VLC_BIN=/Applications/VLC.app/Contents/MacOS/VLC
    
    curl 'http://pub5.di.fm/di_vocaltrance_aac' \
    -H 'Accept: */*' \
    -H 'Connection: keep-alive' \
    -H 'Referer: http://www.di.fm/' \
    -H 'User-Agent: Mozilla/5.0 (Windows NT 6.1) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/41.0.2228.0 Safari/537.36' \ -H 'Accept-Language: en-US,en;q=0.8' \
    --compressed | $VLC_BIN -


Charles Proxy  Method



Suffice to say:
  • Get Charles
  • Use its Rewrite to:
    • Modify the  User-Agent Header  to be that of a valid browser
    • Add the  Referrer Header , being DI.FM's URL
  • Point VLC to the proxy
    • Usually  localhost:8888  or something...
  • Connect to stream through VLC as usual!


Possible Cheap &(!) Clean Methods



  • Tinyproxy  - https://tinyproxy.github.io/ might be worth a look

No comments:

Post a Comment