Closed oracle1wr closed 1 year ago
I'm trying to read radio streams metadata. Stream sample: http://dfm.hostingradio.ru/dfm96.aacp Here is code:
void getStreamMetadata(string streamUrl){ auto rq = Request(); rq.useStreaming = true; rq.verbosity = 3; rq.addHeaders(["Icy-MetaData": "1"]); rq.timeout(30.seconds); auto rs = rq.get(streamUrl); string shift = rs.responseHeaders["icy-metaint"]; writeln(shift); auto stream = rs.receiveAsRange(); while(!stream.empty) { writefln("Received %d bytes, total received %d from document length %d", stream.front.length, rs.contentReceived, rs.contentLength); stream.popFront; } }
The code reads first chunk and stops after it. Here is how result looks like:
> GET /200096.aacp HTTP/1.1 > User-Agent: dlang-requests > Host: radiorecord.hostingradio.ru > Icy-MetaData: 1 > Connection: Keep-Alive > Accept-Encoding: gzip,deflate > < HTTP/1.0 200 OK < content-type: audio/aacp < date: Thu, 20 Oct 2022 23:42:32 GMT < icy-br: 96 < ice-audio-info: channels=2;samplerate=44100;bitrate=96 < icy-br: 96 < icy-description: Stream transcoder based on liquidsoap < icy-genre: various < icy-name: 2000 < icy-pub: 1 < server: Icecast 2.4.0-kh10 < cache-control: no-cache, no-store < access-control-allow-origin: * < access-control-allow-headers: Origin, Accept, X-Requested-With, Content-Type < access-control-allow-methods: GET, OPTIONS, HEAD < connection: Close < expires: Mon, 26 Jul 1997 05:00:00 GMT < icy-metaint: 8192 >> Connect time: 140 ms, 476 μs, and 9 hnsecs >> Request send time: 69 μs and 8 hnsecs >> Response recv time: 93 ms, 887 μs, and 8 hnsecs 8192 Received 786 bytes, total received 0 from document length -1
Same curl works as expected. curl -vvv -H "Icy-MetaData:1" -o /dev/null http://dfm.hostingradio.ru/dfm96.aacp
Not sure, if I'm missing anything. Can you please help?
Hello, @oracle1wr
Thanks for report. Will try to check
Hello @oracle1wr
Please test your code with latest requests commit.
it works as expected, thanks for a quick workaround!
I'm trying to read radio streams metadata. Stream sample: http://dfm.hostingradio.ru/dfm96.aacp Here is code:
The code reads first chunk and stops after it. Here is how result looks like:
Same curl works as expected. curl -vvv -H "Icy-MetaData:1" -o /dev/null http://dfm.hostingradio.ru/dfm96.aacp
Not sure, if I'm missing anything. Can you please help?