Not sure about the legality of this, so I’ll keep it brief. Here’s a tutorial on ripping music from online radio stations using the Linux software package ‘streamripper’.
Everyday Linux User: Using your Raspberry PI to rip music from online radio stations.