哔哩哔哩视频下载,因为要下载一个4k画质的视频奈何要开会员和下载客户端才能下载。
哔哩哔哩的视频有点特殊,他是由视频+音频两个文件组成的,所以把这两个文件下载下来后需要将视频和音频合并。
合并用的ffmpeg的插件,但是不知道为什么有时候会合并失败,不过不重要,把音频和视频下载出来后网上有很多第三方的合并软件可以合成。
使用方式:首先选择文件保存的地址,然后输入视频网页地址,点击确定,然后选择画质一般选4K吧。
然后就等他下载,不得不说哔哩哔哩的网络带宽挺大的,下载十多秒,下载完成后,按照提示点击合并按钮进行合并。
合并完成后你的文件夹有三个文件(音频、视频、合成视频)。
有时候可能会合并失败,多试几次,或者网上找其他的合成工具进行合并
本来想放成品的,但是51限制文件大小3M,就懒得用其他方式上传了 因为没啥技术含量,我把关键代码贴出来就基本上能做出来(贴出的代码就是获取下载链接的,里面包括视频链接和音频链接,然后下载下来用ffmpeg合并)。


源码:
private void button2_Click(object sender, EventArgs e)
{
label2.Visible = true;
HttpHelper http = new HttpHelper();
HttpItem item = new HttpItem
{
URL = textBox1.Text.Trim(),
Host = "www.bilibili.com",
UserAgent = userAgent
};
var result = http.GetHtml(item);
string html = result.Html;
string gl = HttpHelper.GetBetweenHtml(html, "window.__playinfo__=", "</script><script>window.__INITIAL_STATE__");
title = HttpHelper.GetBetweenHtml(html, "<title data-vue-meta=\"true\">", "</title>");
root = (Root)HttpHelper.JsonToObject<Root>(gl);
if (root.code == 0)
{
RadioButton[] radioButton = new RadioButton[root.data.accept_description.Count];
//控件上边缘与容器上边缘的距离
int top = 6;
//记录循环,控件左上角相对于容器左上角的坐标
int i = 0;
int n = 0;
GroupBox gb = new GroupBox();
panel1.AutoScroll = true;
for (n = 0; n < root.data.accept_description.Count; n++)
{
radioButton[n] = new RadioButton();
button3.Visible = true;
if (n % 3 == 0 && n != 0)
{
top += 30;
i = 0;
}
if (n == 0)
{
radioButton[n].Checked = true;
}
radioButton[n].AutoSize = true;
radioButton[n].Top = top;
//控件左上角相对于容器左上角的坐标,以及每个控件之间的距离
radioButton[n].Location = new Point(i * 150 + 2, top);
// MessageBox.Show(name[n].ToString());
radioButton[n].Text = root.data.accept_description[n];
radioButton[n].Visible = true;
radioButton[n].Name = "radioButton" + n;
radioButton[n].Tag = n;
this.panel1.Controls.Add(radioButton[n]);
i++;
}
};
}
//点击下载按钮的代码
foreach (var item in panel1.Controls)
{
if (item is RadioButton)
{
RadioButton radio = item as RadioButton;
if (radio.Checked)
{
var tag = int.Parse(radio.Tag.ToString());
string videourl = root.data.dash.video.ToList()[tag].baseUrl;
string audiourl = root.data.dash.audio.ToList()[0].baseUrl;
//DownloadAudio(audiourl);
//DownloadVideo(videourl);
Thread thread = new Thread(new ParameterizedThreadStart(DownloadVideo));
thread.Start(videourl);
Thread thread2 = new Thread(new ParameterizedThreadStart(DownloadAudio));
thread2.Start(audiourl);
}
}
//合成代码
private void button4_Click(object sender, EventArgs e)
{
this.Invoke((EventHandler)delegate
{
textBox2.Text += DateTime.Now.ToString() + "合并中 请稍后...\r\n";
});
string path = textBox3.Text + guid ;
string avi = textBox3.Text +"合并视频";
string arguments = "-i " + path + ".avi -i " + path + ".aac -vcodec copy -acodec copy " + avi + ".avi";
//arguments = "-i " + path + ".avi -i " + path + ".aac -c:v copy -c:a aac -strict experimental " + avi + ".avi";
Process p = new Process();
p.StartInfo.FileName = "ffmpeg.exe";
p.StartInfo.Arguments = arguments;
p.StartInfo.WindowStyle = ProcessWindowStyle.Hidden;
// p.StartInfo.RedirectStandardError = true;
p.ErrorDataReceived += new DataReceivedEventHandler(Output);//外部程序
p.Start();//启动线程
timer1.Enabled = true;
}





![MBTI 16型人格职业性格测试源码PC+H5自适应完整版基于ThinkPHP框架[亲测可用]](https://www.icbot.net/upload/portal/20250429/32ccad646f32a5f4926b3b7b5ef3232a.png)















