badlogic / orfondl

Downloader for videos on ORF ON
BSD 3-Clause "New" or "Revised" License
21 stars 1 forks source link

enable download from "sound.orf.at" #3

Open toughIQ opened 9 months ago

toughIQ commented 9 months ago

I am not sure what the difference is between "sound.orf.at" and "on.orf.at" But if its easy to do, than the possibility of downloading audio from "sound.orf.at" would also be nice.

Eg: https://sound.orf.at/radio/stm/sendung/38167/klingende-steiermark

Currently I dont know the technical difference of these two sources.

badlogic commented 9 months ago

Had a quick look. Weirdly enough, this is much more involved than orf on. It's a simple shoutcast MP3 stream, but extracting the URL for a specific show requires JS execution. E.g.

https://sound.orf.at/collection/4/47620/black-history-month-noomi-anyanwu-uber-black-joy

Just loading the raw HTML of the page doesn't give us anything. There are 2 <audio> elements in there. When you start playback by clicking the play button, one of the audio elements' src attribute it set via JS, but it's unclear how to get to that data just by downloading static HTML/JS assets.

Screenshot 2024-02-04 at 19 28 56
badlogic commented 9 months ago

OK, the frontend issues an API request to https://audioapi.orf.at/fm4/api/json/5.0/broadcastitem/2476251

where the last path element is the id of the show/broadcast. That gives us nice JSON which contains the stream URLs.

Screenshot 2024-02-04 at 19 38 37

Now the question is how to map a URL like https://sound.orf.at/collection/4/47620/black-history-month-noomi-anyanwu-uber-black-joy to the id passed to the API.

toughIQ commented 9 months ago

Thanks. Please consider this a feature request Would be a nice to have...but not important :-)

farOverNinethousand commented 9 months ago

@badlogic You may find some interesting information on those API calls inside the source code of JDownloader, see: https://github.com/mycodedoesnotcompile2/jdownloader_mirror/blob/main/svn_trunk/src/jd/plugins/decrypter/OrfAt.java#L510