TuneIn radio api
Project description
TuneIn
Unofficial python api for TuneIn, with first-class mediavocab integration.
Usage
From the command line
tunein ships a basic CLI for searching. Output is available in both
json and table formats; the default is the table layout.
tunein search "Radio paradise"
tunein search "Radio paradise" --format json
CLI help is available with tunein --help.
From Python
from tunein import TuneIn
for station in TuneIn.search("BBC Radio 4"):
print(station.title, station.stream, station.bit_rate)
mediavocab integration
TuneInStation.to_release() emits a canonical mediavocab.Release so
downstream consumers (OCP, recommendation engines, catalogue importers)
can ingest TuneIn data without bespoke glue code.
Per mediavocab axiom 8 (station identity), each TuneIn channel is
modelled as a Work with MediaType.RADIO, and the playable stream
URL is a Release with StreamMode.CONTINUOUS (live linear
broadcast — not seekable on-demand audio).
from tunein import TuneIn
# Fast path — search payload only.
for release in (s.to_release() for s in TuneIn.search("BBC Radio 4")):
print(release.uri, release.codec, release.bitrate)
# Rich path — opt in to the per-station Describe.ashx call to populate
# genre, language, country, call-sign, slogan, etc.
for station in TuneIn.search("BBC Radio 4", enrich=True):
release = station.to_release()
print(release.work.title) # "BBC Radio 4"
print(release.work.country) # "GB" (parsed from "London, UK")
print(release.work.language) # "en" (mapped from "English")
print(release.work.content_genres) # ["news"] (mapped to GENRE_NEWS)
print(release.work.aka) # ["BBC R4"] (call-sign)
print(release.codec, release.bitrate) # "aac", "128"
print(release.audio_channels) # "stereo"
TuneIn's Tune.ashx endpoint returns multiple stream URLs per station
(different bitrates, mirrors, and protocols — HLS, MP3, AAC). Each
stream becomes its own Release so consumers can pick the best fit at
playback time.
The full set of mediavocab external ids emitted is:
| key | source |
|---|---|
tunein_station_id |
guide_id / preset_id |
tunein_url |
OPML Tune.ashx URL |
tunein_web_url |
Public tunein.com/station/?stationId=… |
tunein_logo_url |
Station logo URL |
Enriched stations also carry slogan, location, frequency, band,
twitter_id, and content_classification under work.extra. The
now-playing label (when present) is preserved in
work.extra["current_track"].
Why no Programme / Schedule?
mediavocab 0.3 introduced Programme and Schedule for EPG data. The
TuneIn search/browse endpoints expose a now-playing label but no
start/end timestamps, and Programme requires an ISO-validated
starts_at. This client therefore preserves the now-playing string in
work.extra["current_track"] rather than fabricating a timestamp. If a
future TuneIn endpoint exposes a real schedule feed, it can be lifted
into Programme(work=show_ref, channel=station_ref, starts_at=...)
without changing the existing surface.
Pluggable HTTP transport
By default the client uses :mod:requests. For stealthier scraping
(TLS fingerprint matching a real browser via
curl_cffi), install the
stealth extra and set the TUNEIN_TRANSPORT env var:
pip install tunein[stealth]
export TUNEIN_TRANSPORT=curl_cffi
You can also inject any session-shaped object explicitly:
from tunein import TuneIn
import requests
s = requests.Session()
s.headers["User-Agent"] = "my-bot/1.0"
client = TuneIn(session=s)
results = client.search_stations("BBC Radio 4")
TuneIn.search, TuneIn.featured, and TuneIn.get_stream_urls also
accept a session= keyword for one-shot calls without instantiating
the client.
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file tunein-0.1.1a1.tar.gz.
File metadata
- Download URL: tunein-0.1.1a1.tar.gz
- Upload date:
- Size: 27.4 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.1.0 CPython/3.13.12
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
d0f9907a307d14aa184953fa0b23d4535ce7a059441e57a789db65a5da8aec57
|
|
| MD5 |
2bae0019d98c3d1cba298e1f8a9dd154
|
|
| BLAKE2b-256 |
494ea8debd13be8d7c87c87741245266f3495ba97bd8db822a89b13b5fe2e6cd
|
File details
Details for the file tunein-0.1.1a1-py3-none-any.whl.
File metadata
- Download URL: tunein-0.1.1a1-py3-none-any.whl
- Upload date:
- Size: 31.3 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.1.0 CPython/3.13.12
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
66122825bfa939f9113a5049f758ce0711945f1600fd65abeb5c05c42939c444
|
|
| MD5 |
fd0f48574b69350f27c0577d5eba1a65
|
|
| BLAKE2b-256 |
6d9d59ce78a5ddc4f6c3b7bf5e385da08517a7b7149c00d77f1b22e0ce6f90e9
|