[英]How can I record online radio in .NET?
I did see this question but not much on .NET... 我确实看到了这个问题,但在.NET上并没有太多...
I want to write .NET code to connect to a web server streaming SHOUTcast (Winamp) audio content (if anyone is interested, the URL is http://live.radiotrinitas.ro:8000/ ) and record it. 我想编写.NET代码来连接到流媒体SHOUTcast(Winamp)音频内容的Web服务器(如果有人有兴趣,URL是http://live.radiotrinitas.ro:8000/ )并记录它。
But I don't know much how to do it . 但我不知道怎么做 。
Just open the HTTP connection, and stream it off to a file on the disk? 只需打开HTTP连接,然后将其流式传输到磁盘上的文件中?
There are some headers that appear to be in the content (or so it seems to me) and I don't know what the format is so how to name the extension of the file (MP3?) 有一些标题似乎在内容中(或者在我看来),我不知道格式是什么,所以如何命名文件的扩展名(MP3?)
Update1 : Update1:
I did try to connect using HttpWebRequest but it throws up saying ProtocolViolation. 我确实尝试使用HttpWebRequest进行连接,但它却抛出了ProtocolViolation。 Then I tried connecting using TcpClient and it doesn't send back anything.
然后我尝试使用TcpClient连接,它不会发回任何东西。 I guess it awaits some starting command.
我猜它等待一些启动命令。 I don't know this, apparently proprietary (?), protocol...
我不知道这个,显然是专有的(?),协议......
Well it seems someone over CodeProject posted something useful and working! 好吧,似乎有人在CodeProject上发布了一些有用且有效的东西!
http://www.codeproject.com/KB/audio-video/SHOUTcastRipper.aspx http://www.codeproject.com/KB/audio-video/SHOUTcastRipper.aspx
To run the code snippet you need to set the following configuration : 要运行代码段,您需要设置以下配置:
<?xml version="1.0" encoding="utf-8" ?>
<configuration>
<system.net>
<settings>
<httpWebRequest useUnsafeHeaderParsing="true"/>
</settings>
</system.net>
</configuration>
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.