From f62045074793dff476a6aaceb3ef0ad36632bbf2 Mon Sep 17 00:00:00 2001 From: david-hust <9286661@qq.com> Date: Wed, 16 Sep 2020 10:46:06 +0800 Subject: [PATCH] grab https://www.kugou.com/ --- grab.kugou.js | 30 ++++++++++++++++++++++++++++++ 1 file changed, 30 insertions(+) create mode 100644 grab.kugou.js diff --git a/grab.kugou.js b/grab.kugou.js new file mode 100644 index 0000000..4fa1f07 --- /dev/null +++ b/grab.kugou.js @@ -0,0 +1,30 @@ +var Grab_Kugou = { + version: 'grab.kugou', + patchDownload: function () { + $('.list-action-down').off('click').on('click', function () { + var $a = $(this), + idx = parseInt($a.parent().parent().parent().find('.musiclist-number').text(), 10), + playList = play.getPlayList(); + if (!isNaN(idx) && idx > 0 && playList && idx <= playList.length) { + var song = playList[idx - 1]; + play.getdatabyhash({ + Hash: song.Hash, + album_id: song.album_id, + callback: function (res) { + if (res.data.play_url) { + var ext = res.data.play_url.split('.'); + ext = '.' + ext[ext.length - 1]; + // console.log(res.data.song_name + ext, res.data.play_url); + console.log(res.data.audio_name); + $a.attr({'href': res.data.play_url, 'target': '_blank', 'download': res.data.song_name + ext}).off('click'); + } + } + }); + } + event.stopPropagation(); + }); + } +} + +if (!$ || !play) alert('script version unmatch!'); +else Grab_Kugou.patchDownload(); -- GitLab