diff options
| author | jade (winter) | 2026-07-20 13:35:01 +0100 |
|---|---|---|
| committer | jade (winter) | 2026-07-20 13:35:01 +0100 |
| commit | d5ea0f332bf8e5f0745e2c0e592ee895423a70ad (patch) | |
| tree | 1649ba6a70b64623b5b1692359b4a70cb89970f1 /lib/sounds-auth.php | |
| parent | 5f301e85b24f3a219c3020a8e24113c31a2a1058 (diff) | |
add live playback support
Diffstat (limited to 'lib/sounds-auth.php')
| -rw-r--r-- | lib/sounds-auth.php | 15 |
1 files changed, 15 insertions, 0 deletions
diff --git a/lib/sounds-auth.php b/lib/sounds-auth.php new file mode 100644 index 0000000..91e2599 --- /dev/null +++ b/lib/sounds-auth.php @@ -0,0 +1,15 @@ +<?php + +// where does 1d590d3 come from? i have no clue +const SOUNDS_NEXT_DATA_BASE = 'https://www.bbc.co.uk/sounds/_next/data/1d590d3'; +const SOUNDS_NEXT_DATA_LIVE = '/play/live/{service}.json'; + +function sounds_fetchPageData(string $path) { + return json_decode(file_get_contents(SOUNDS_NEXT_DATA_BASE . $path)); +} + +function sounds_getLiveBearerToken(string $service) { + return sounds_fetchPageData( + str_replace('{service}', $service, SOUNDS_NEXT_DATA_LIVE) + )->pageProps->jwtToken; +} |
