如何在ASP.net的实时网站上保存mp3文件?

问题描述

我从youtube链接获取了完整的视频数据,然后将其转换为MP3格式。所有这些都可以在localhost上使用,但是当我将其投入使用时则不能使用。 查看:

<form method="post" style="display:inline" action="@Url.Action("DownloadVideoFunc","Home",new {@link=item.Link})">
                    @Html.Hidden("returnURL",this.Request.RawUrl)
                    <button onclick="CallToastFunction();" type="submit" class="btn btn-outline-primary">
                        Download MP3 too
                    </button>
                </form>

这是控制器功能

    var youTube = YouTube.Default; // starting point for YouTube actions
var video = youTube.GetVideo(link); // gets a Video object with info about the video
var path= Path.GetTempPath();
System.IO.File.WriteallBytes(path + video.FullName,video.GetBytes());//@"D:\"
var inputFile = new MediaFile { Filename = path + video.FullName };
var outputFile = new MediaFile { Filename = $"{path + video.Title}.mp3" };
using (var engine = new Engine())
{
engine.GetMetadata(inputFile);
engine.Convert(inputFile,outputFile);
}
System.IO.File.Delete(path + video.FullName);

它不保存文件并给出错误。我可以使用任何JS函数或C#函数来下载文件

解决方法

暂无找到可以解决该程序问题的有效方法,小编努力寻找整理中!

如果你已经找到好的解决方法,欢迎将解决方案带上本链接一起发送给小编。

小编邮箱:dio#foxmail.com (将#修改为@)