//https://y.gtimg.cn/music/portal/js/common/pkg/common_b40e83e.js?max_age=31536000:formatted
formatMusic: function(e) {
function t(e) {
if (!e)
return {};
if ("string" == typeof e)
try {
e = JSON.parse(e)
} catch (t) {
return {}
}
if ("object" == typeof e) {
var i = {};
(e.url || e.songurl) && (i.songurl = e.url || e.songurl),
i.songid = e.docid && !e.id ? e.docid : e.id,
i.songmid = e.mid,
i.songtype = e.songtype,
i.songname = e.name,
i.songtitle = e.title,
i.songsubtitle = e.subtitle || (e.album && e.album.subtitle ? e.album.subtitle : "") || "",
i.type = e.type,
i.songtype = e.type,
i.cdIdx = e.index_cd,
i.interval = e.interval,
i.isonly = e.isonly,
i.singer = e.singer,
i.album = e.album,
i.title = e.title,
i.title_hilight = e.title_hilight,
i.subtitle = e.subtitle,
e.album && (i.albumid = e.album.id,
i.albummid = e.album.mid,
i.albumname = e.album.name),
e.file && (i.strMediaMid = e.file.media_mid,
i.sizeape = e.file.size_ape,
i.size128 = e.file.size_128 || e.file.size_128mp3,
i.size320 = e.file.size_320,
i.sizeflac = e.file.size_plac,
i.sizeogg = e.file.size_ogg,
i.preview = {},
i.preview.trybegin = e.file.try_begin,
i.preview.tryend = e.file.try_end,
i.preview.trysize = e.file.size_try),
e.pay && (i.pay = {},
i.pay.payalbumprice = e.pay.price_album,
i.pay.paydownload = e.pay.pay_download,
i.pay.payplay = e.pay.pay_play,
i.pay.timefree = e.pay.time_free),
e.action && (i.msgid = e.action.msgid || e.action.msg,
i["switch"] = e.action["switch"] || e.action.switches,
i.alertid = e.action.alert),
i.vid = e.mv ? e.mv.vid : "";
for (var n in i.singer)
i.singer[n].name = i.singer[n].title;
return i.grp = e.grp,
i
}
}
if ("string" == typeof e)
try {
e = JSON.parse(e)
} catch (i) {}
if (e && (e.id = parseInt(e.id)),
e && (e.id > 0 || "undefined" != typeof e.id) && !(e.songid > 0 || e.songmid) && (e = t(e)),
8623 != e.albumid && e.albumid || (e.albumName || (e.albumName = e.albumname),
e.albumname = ""),
"object" == typeof e) {
if ((1 == e.nodeType || e.constructor == $) && (e = JSON.parse(this.getSongData(e))),
e.formatted)
return e;
"undefined" != typeof e.type && 0 == e.type || "undefined" != typeof e["switch"] && 0 != e["switch"] || (e["switch"] = 403),
e["switch"] || (e["switch"] = 403);
var n = e["switch"].toString(2).split("");
n.pop(),
n.reverse();
var o = ["play_lq", "play_hq", "play_sq", "down_lq", "down_hq", "down_sq", "soso", "fav", "share", "bgm", "ring", "sing", "radio", "try", "give"];
e.action = {};
for (var a = 0; a < o.length; a++)
e.action[o[a]] = parseInt(n[a], 10) || 0;
e.pay = e.pay || {},
e.preview = e.preview || {},
e.playTime = makePlayTime(e.interval),
e.action.play = 0,
(e.action.play_lq || e.action.play_hq || e.action.play_sq) && (e.action.play = 1),
e.tryPlay = 0,
e.action["try"] && e.preview.trysize > 0 && (e.tryPlay = 1),
e.anyPlay = 0,
(e.action.play || e.tryPlay) && (e.anyPlay = 1),
e.tryIcon = 0,
e.disabled = 0,
e.action.play || e.pay.payplay || e.pay.paydownload || (e.tryPlay ? e.tryIcon = 1 : e.disabled = 1),
e.sosoFlag = 0,
(e.action.soso || 0 != e.type) && (e.sosoFlag = 1),
e.formatted = 1,
e.mtype = 0 != e.type ? "net" : "qqmusic",
0 == e.type && 1 == e.action.soso && (e.type = 3,
e.mtype = "net",
e.songurl = "http://isure.stream.qqmusic.qq.com/C100" + e.songmid + ".m4a?fromtag=0"),
e.url && (e.songurl = e.url),
"qqmusic" == e.mtype && (e.songurl = ""),
35 == e.songtype && (e.songurl += "&fx=.m4a"),
e.docid && !e.songid && (e.songid = e.docid),
e.mid = (e.songid || 0).toString(),
e.songname = e.songname ? e.songname.entityReplace() : "",
e.albumname = e.albumname ? e.albumname.entityReplace() : "";
for (var a = 0; a < e.singer.length; a++)
e.singer[a].name = e.singer[a].name ? e.singer[a].name.entityReplace() : "",
0 == a && (e.singername = e.singer[0].name,
e.singerid = e.singer[0].id,
e.singermid = e.singer[0].mid);
e.formatted = 1,
e.fav = ""
}
if (e.type > 0) {
var s = e;
111 == s.type || 112 == s.type || 113 == s.type ? e.mtype = "qqmusic" : e.songurl = "http://dl.stream.qqmusic.qq.com/C100" + (s.strMediaMid || s.songmid) + ".m4a?fromtag=38"
}
return e
}
参数e
浏览器local storage缓存的y_playlist数据:
{
"songurl": "",
"songid": 5026521,
"songmid": "002rCSQm16ID6s",
"songtype": 0,
"songname": "Teenage Dream",
"songtitle": "Teenage Dream (Manhattan Clique Edit)",
"songsubtitle": "",
"type": 0,
"cdIdx": 0,
"interval": 400,
"isonly": 0,
"singer": [{
"id": 13157,
"mid": "004PTEQR3C16SV",
"name": "Katy Perry",
"title": "Katy Perry",
"type": 1,
"uin": 0
}],
"album": {
"id": 439224,
"mid": "001ZPa910hJyci",
"name": "G-A-Y",
"title": "G-A-Y",
"subtitle": "",
"time_public": "2013-10-04"
},
"title": "Teenage Dream (Manhattan Clique Edit)",
"subtitle": "",
"albumid": 439224,
"albummid": "001ZPa910hJyci",
"albumname": "G-A-Y",
"strMediaMid": "0015o1Pi1klEUc",
"sizeape": 0,
"size128": 6407964,
"preview": {
"trybegin": 0,
"tryend": 0,
"trysize": 0
},
"pay": {
"payalbumprice": 0,
"payplay": 0,
"timefree": 0
},
"msgid": 14,
"switch": 17413891,
"alertid": 2,
"vid": "",
"action": {
"play_lq": 1,
"play_hq": 0,
"play_sq": 0,
"down_lq": 0,
"down_hq": 0,
"down_sq": 0,
"soso": 0,
"fav": 1,
"share": 1,
"bgm": 1,
"ring": 0,
"sing": 1,
"radio": 1,
"try": 0,
"give": 1,
"play": 1
},
"playTime": "06:40",
"tryPlay": 0,
"anyPlay": 1,
"tryIcon": 0,
"disabled": 0,
"sosoFlag": 0,
"formatted": 1,
"mtype": "qqmusic",
"mid": "5026521",
"singername": "Katy Perry",
"singerid": 13157,
"singermid": "004PTEQR3C16SV",
"fav": "",
"id": null,
"ix": 0,
"docid": "",
"toptype": 10050,
"parentid": 5026521
}