代码:
string content = AllFunctions.streamToString(stream, Encoding.UTF8);
Regex regex = new Regex("\\/song\\?id=[0-9]{5,8}"); //歌曲id
if (!regex.IsMatch(content))
{
return;
}
allurls = regex.Matches(content); //所有匹配项
random = new Random(Guid.NewGuid().GetHashCode()); //随机数
index = random.Next(allurls.Count); //
listUrl = "http://music.163.com" + allurls[index];
string songID = allurls[index].Value.Split('=')[1]; //在这里赋值的啊!
musicUrl = "http://music.163.com/api/song/detail/?id=" + songID + "&ids=%5B" + songID + "%5D?csrf_token=" + csrf_token; //在这里使用就没有错误!!
getPlaySite: stream = AllFunctions.getOrPostUrl(musicUrl, 0, "", cookie, out outCookie, header, out outHeader, false, null, 0); //获取歌曲播放链接
content = AllFunctions.streamToString(stream, Encoding.UTF8);
string mp3Url = "", songDuration = "";
try
{
///
}
catch
{
return;
}
musicUrl = "http://music.163.com/api/log/web?csrf_token=" + csrf_token; //播放开始和结束的时候需要post的链接
postData = "action=play&json={\"id\":\"" + songID + "\",\"type\":\"song\"}";
最后一句的时候,提示我songID没赋值,无法编译?
我明明在最前面赋值的了啊,而且前面使用都没有错误,最后一句就说没赋值??
第一次发帖,希望大家帮帮我,谢谢