2022-07-7 更新
// 第一次执行
var jquery = document.createElement('script');
jquery.src = 'https://cdn.bootcss.com/jquery/3.4.1/jquery.min.js';
document.getElementsByTagName('head')[0].appendChild(jquery);
// 第二次执行,必须与第一次分开
let wait_time = 1000,index = 0;
let selector='.sound-list ul .xuicon-web_album_btn_play_s';
let len = $(selector).length;
localStorage.download_cmd='';
localStorage.download_playing_name='';
function playAudio() {
console.log(index,$(selector)[index]);
$(selector)[index].click();
}
function getDownloadCommand(){
let player = JSON.parse(localStorage.PLAYER_STATE).currentTrack;// 获取当前播放曲目
if(localStorage.download_playing_name == player.trackName){ // 单曲名称
console.log('重复:wget '+player.trackName);
} else {
let down_cmd = 'wget -c -T 3 -t 100 "' + player.src + '" -O "' + player.trackName + '.m4a";'+"\r\n"; // player.src 单独下载地址
console.log(down_cmd);
localStorage.download_cmd+=down_cmd;
localStorage.download_playing_name=player.trackName;
index ++;
}
}
playAudio();// 先播放第一个,后面才好开始分析下载链接
for (var i = 0; i < len; i++) {
setTimeout( function(){getDownloadCommand();playAudio();}, wait_time)
wait_time += 8000;
};
// 然后在localStorage中复制download_cmd的值即可下载
// 查看调试可在console的过滤 Filter 中输入 wget
// 之后每次想要下载新的专辑都可以进入那个页面的控制台,方向键向上三下,即可快速操作。
<a href="javascript:var jq=document.createElement('script');jq.src='https://cdn.bootcss.com/jquery/3.4.1/jquery.min.js',jq.onload=function(){jQuery.noConflict()},document.getElementsByTagName('head')[0].appendChild(jq);">引入Jquery</a>
<a href="javascript:(let wait_time = 1000,index = 0,selector='.sound-list ul .defaultDOM';let len = $(selector).length;function playAudio() {$(selector)[index].click();console.log(index,$(selector)[index]);index ++;}function getDownloadCommand(){let player = JSON.parse(localStorage.player_track);let down_cmd = 'wget -c -T 3 -t 100 \'' + player.src + '\' -O \'' + player.trackName + '.m4a\'';console.log(down_cmd);})">喜马拉雅下载准备</a>
<a href="javascript:(selector='.sound-list ul .defaultDOM';len = $(selector).length;for (var i = 0; i <= len; i++) {setTimeout( function(){ playAudio(); getDownloadCommand();}, wait_time);wait_time += 8000;};setTimeout( function(){ getDownloadCommand();}, wait_time);)">喜马拉雅开始下载</a>
<a href="javascript:()">开始下载</a>