Files
Airplay-Predictor/docs/DATA_SOURCES.md
T

48 lines
3.5 KiB
Markdown
Raw Blame History

This file contains ambiguous Unicode characters
This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
# Data sources
Found on 2026-11-15. All of these sources are public and need no login or API key. The collector
identifies itself and waits between requests.
**The big constraint:** every source of exact plays keeps only **about 7 days**. History only
exists from the day collection starts, so the collector runs every 6 hours.
## DR (P3, P4 regions, P5, P6 Beat, P8 Jazz)
DR's pages are Next.js. Each page's data is the JSON in `<script id="__NEXT_DATA__">` under
`props.pageProps`. (`api.dr.dk` needs an API key that isn't in the public pages, so it isn't used.)
| What | URL | Gives |
|---|---|---|
| A day's programmes | `/playlister/{channel}/{YYYY-MM-DD}` | `schedule.items[]`: `slug`, `title`, `startTime`, `endTime` (UTC) |
| A programme's plays | `/playlister/{channel}/{date}/{slug}` | `playlistIndexPoints[]`: `playedTime` (with offset), `title`, `durationMilliseconds`, `trackUrn`, `roles[]` (`artistUrn`, `name`, `role`; the main artist is `Hovedkunstner`) |
| An artist | `/lyd/musik/kunstner/{id}` (the slug is optional) | `weekPlaySums[]`: **52 weeks** of plays per channel; `mostPlayed[]`: all-time plays per track per channel; `latestPlayed[]`: the last 20 plays |
| Rotation lists | linked weekly from `dr.dk/rotationer` (`asset.dr.dk/.../DD-MM-YYYY-dr-rotationer.pdf`) | per channel, the songs in each rotation category A / B / C for the coming week |
- **Channels:** `p3`, `p4kbh`, `p4sjaelland`, `p4fyn`, `p4syd`, `p4trekanten`, `p4vest`, `p4aarhus`, `p4nord`, `p4bornholm`, `p4esbjerg`, `p5`, `p6beat`, `p8jazz`. The national `p4` page exists too, but its plays come from the regions.
- **Window:** dates older than about 7 days give 404.
- **Artist pages:** they give a year of weekly history the moment an artist is discovered. This is the only long history available.
- **Rotation PDF:**
- Text is extractable: categories as headings, then artist and title on the same line.
- Pages 0–2 and 11 hold the lists; the others are graphics.
- The channel names aren't in the text (probably logos), so mapping pages to channels is still to do.
- Only the current PDF is linked, and its URL changes weekly, so old weeks can't be fetched later.
## Bauer Media Denmark (NOVA, Radio Soft, The Voice, Pop FM, Radio 100, + web stations)
Radioplay became Rayo (`rayo.dk`). It uses Bauer's international API:
| What | URL | Gives |
|---|---|---|
| Stations | `https://listenapi.planetradio.co.uk/api9.2/stations/DK` | `stationCode`, `stationName` (about 80, many web-only) |
| Plays | `.../api9.2/events/{code}/{YYYY-MM-DD HH:MM:SS}/{n}` | the `n` (≤ 100) plays before that time, newest first: `nowPlayingTime` (Danish local time), `nowPlayingArtist`, `nowPlayingTrack`, `nowPlayingTrackId`, `nowPlayingDuration` (seconds) |
| Now playing | `.../api9.2/nowplaying/{code}` | the current event |
- **Codes:** NOVA `nov`, Radio Soft `dso`, The Voice `the`, Pop FM `pop`, Radio 100 `rhu`.
- **Errors:** older than about 7 days gives HTTP 200 with `["invalid date"]`; `n` > 100 gives `["invalid limit"]`.
- **Artists:** one string, featured artists included (`"Eminem ft. Rihanna"`), with no artist ids. Normalising names is part of the modelling work.
- **Why Bauer matters:** it records every play, including songs outside any published rotation list, and the same API serves Bauer's stations in other countries.
## Station ranking (Kantar)
The four biggest Danish stations for music are DR P4, DR P3, NOVA and Radio Soft; DR P4 is split into 10 regional channels. The collector covers all four, plus the other DR music channels and Bauer's other Danish stations.