C#实现的网易云音频下载器(白嫖)

2023-04-27,,

链接

下载点这里

主要是想白嫖音乐,但是java gui写的很复杂,python不会写,c#学的也是半吊子,大大佬们勿喷

经测试大部分音乐可以下载,部分会出现路径非法

form.cs的代码

using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows.Forms;
using System.IO;
using System.Net;
using System.Text.RegularExpressions; namespace demo1
{
public partial class Form1 : Form
{
public Form1()
{
//界面初始化
InitializeComponent();
} private void button1_Click(object sender, EventArgs e)
{
textBox1.Text = ""; } private void button2_Click(object sender, EventArgs e)
{
string id = textBox1.Text;
string ss = (SendHttpPost("https://api.imjad.cn/cloudmusic/?type=song&tlyric&id="+id, ""));
WebClient wc = new WebClient();
wc.Encoding = Encoding.UTF8;
// wc.DownloadFile(ss, @"D:\\test\"+id+".mp3");
string currentPath= System.IO.Directory.GetCurrentDirectory();
wc.DownloadFile(ss,currentPath+"\\"+id + ".mp3");
MessageBox.Show("下载完成");
}
public static string SendHttpPost(string url, string paraJsonStr)
{
WebClient wc = new WebClient();
wc.Headers.Add("Contene-Type", "Application/x-www-FormatException-urlencoded");
byte[] p = System.Text.Encoding.UTF8.GetBytes(paraJsonStr);
byte[] r = wc.UploadData(url, "POST", p);
string returnStr = System.Text.Encoding.UTF8.GetString(r);
Console.WriteLine(returnStr);
string re = @"(https:)(.*)," + "\"br\"";
Console.WriteLine(re);
MatchCollection matches = Regex.Matches(returnStr, re); foreach (Match item in matches)
{
returnStr = item.Value;
}
Console.WriteLine(returnStr); //url //去掉换行
returnStr = returnStr.Substring(0, returnStr.Length - 6); //去掉转义字符
returnStr = returnStr.Replace("\\/", "/"); Console.WriteLine(returnStr);
return returnStr;
} private void label4_Click(object sender, EventArgs e)
{ } private void button3_Click(object sender, EventArgs e)
{
MessageBox.Show(System.IO.Directory.GetCurrentDirectory());
}
}
}

C#实现的网易音频下载器(白嫖)的相关教程结束。

《C#实现的网易云音频下载器(白嫖).doc》

下载本文的Word格式文档,以方便收藏与打印。