DEV Community

Signal Live Radio
Signal Live Radio

Posted on

Finding live radio streams near any US ZIP code with the free Radio Browser API

I make a small radio app, Signal Live Radio, and its station directory comes from Radio Browser (radio-browser.info), a free, community-run database of internet radio streams. If you've ever wanted to build something that plays "the stations near here", it's a great place to start. Here's how to query it.

1. Pick a server

Radio Browser runs several mirrors. Their docs ask clients to look up the server list instead of hard-coding one, and to send a descriptive User-Agent.

curl -s https://all.api.radio-browser.info/json/servers
Enter fullscreen mode Exit fullscreen mode

For the examples below I use de1.api.radio-browser.info.

2. Search by state

curl -s -A "my-radio-app/1.0" "https://de1.api.radio-browser.info/json/stations/search?countrycode=US&state=Texas&hidebroken=true&order=clickcount&reverse=true&limit=10"
Enter fullscreen mode Exit fullscreen mode
  • hidebroken=true drops streams that failed the last check.
  • order=clickcount&reverse=true puts the most-played stations first.
  • Each result has url_resolved, which is the stream URL you hand to your audio player.

3. Search near a point

Stations that have coordinates can be searched by distance (in meters):

curl -s -A "my-radio-app/1.0" "https://de1.api.radio-browser.info/json/stations/search?geo_lat=40.71&geo_long=-74.00&geo_distance=20000&hidebroken=true&limit=20"
Enter fullscreen mode Exit fullscreen mode

To go from a ZIP code to a point, you need a ZIP-to-coordinates table. The US Census Bureau publishes a free ZCTA "gazetteer" file with a center latitude and longitude for each ZIP Code Tabulation Area. Load it once, look up the ZIP, then run the geo search.

4. Don't trust geo alone

Not every station has coordinates, so a geo-only search misses some. A practical approach is to merge two queries, one by distance and one by state, then dedupe on stationuuid.

5. Be a good citizen

  • Send a real User-Agent.
  • When a user actually plays a station, call /json/url/{stationuuid}. That counts the click, which helps keep the popularity ranking useful for everyone.
  • Cache results, because station lists don't change minute to minute.

The app

If you just want to listen instead of build, Signal Live Radio is free with ads. Type a ZIP code to see live stations for that area, browse by genre, and save Presets. No account. It streams over the internet and is not an AM/FM tuner.

Search "Signal Live Radio" on the App Store or Google Play.

Top comments (0)