Skip to content

Instantly share code, notes, and snippets.

@iamgqb
Created July 17, 2019 13:10
Show Gist options
  • Select an option

  • Save iamgqb/757758c5c1de5a54131c4c06656655b1 to your computer and use it in GitHub Desktop.

Select an option

Save iamgqb/757758c5c1de5a54131c4c06656655b1 to your computer and use it in GitHub Desktop.
fiddler 抓取 uwp 版网易云的歌曲
static var v_neteaeid: String = null;
static var Netease_Path: String = "C:\\Users\\Gqb\\Music\\netease\\";
// netease music
public static RulesOption("Netease Music Download")
var m_netease: boolean = true;
static function OnBeforeResponse(oSession: Session) {
if (m_Hide304s && oSession.responseCode == 304) {
oSession["ui-hide"] = "true";
}
var fullUrl = oSession.fullUrl;
// get music id;
if (m_netease &&fullUrl.Contains("music.163.com/eapi/song/enhance/player/url")) {
var oResponseString: String = oSession.GetResponseBodyAsString();
var oJson = Fiddler.WebFormats.JSON.JsonDecode(oResponseString);
v_neteaeid = oJson.JSONObject["data"][0]["id"];
}
// get album art; 180x180
// album art can be cached, so it`s body maybe empty;
// but this is not
// but we can get detail from https://music.163.com/#/song?id=511332759
if (
m_netease && v_neteaeid &&
fullUrl.Contains("music.126.net") && fullUrl.Contains(".jpg") && fullUrl.Contains("180z180") &&
oSession.ResponseBody.Length > 0
) {
var fileName = Netease_Path + v_neteaeid + ".jpg";
Fiddler.Utilities.WriteArrayToFile(fileName, oSession.ResponseBody);
}
// get music AND clear id;
if (
m_netease && v_neteaeid &&
fullUrl.Contains("music.126.net") && fullUrl.EndsWith(".mp3") &&
oSession.ResponseBody.Length > 0
) {
var fileName = Netease_Path + v_neteaeid + ".mp3";
Fiddler.Utilities.WriteArrayToFile(fileName, oSession.ResponseBody);
// clear id after save music
v_neteaeid = null;
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment