您需要先安装一个扩展,例如 篡改猴、Greasemonkey 或 暴力猴,之后才能安装此脚本。
您需要先安装一个扩展,例如 篡改猴 或 暴力猴,之后才能安装此脚本。
您需要先安装一个扩展,例如 篡改猴 或 暴力猴,之后才能安装此脚本。
您需要先安装一个扩展,例如 篡改猴 或 Userscripts ,之后才能安装此脚本。
您需要先安装一款用户脚本管理器扩展,例如 Tampermonkey,才能安装此脚本。
您需要先安装用户脚本管理器扩展后才能安装此脚本。
喜马拉雅音乐或视频下载
当前为
// ==UserScript== // @name ximalaya-download // @namespace https://gf.qytechs.cn/zh-CN/users/135090 // @grant none // @version 1.3.9 // @author zwb83925462 // @license BSD // @description 喜马拉雅音乐或视频下载 // @run-at document-end // @require https://registry.npmmirror.com/ajax-hook/3.0.3/files/dist/ajaxhook.min.js // @require https://registry.npmmirror.com/crypto-js/4.2.0/files/crypto-js.js // @require https://registry.npmmirror.com/jquery/3.7.1/files/dist/jquery.min.js // @match https://www.ximalaya.com/sound/* // @match https://www.ximalaya.com/album/* // ==/UserScript== (function() { 'use strict'; if (location.pathname.includes("/sound/")){ var playurl; var title=document.querySelector("h1.title")?.textContent || document.querySelector("h1.title-wrapper")?.textContent; if (window?.location?.pathname?.includes("sound")){ var trackid=window?.location?.pathname?.split("/")[2]; var item={ id:trackid }; setTimeout(function(){ var link = document.createElement("a"); var container = document.body; link.id="mp4"; link.download=title.concat(".mp4"); link.style="position:fixed;top:8%;left:8%"; link.style.display = "block"; link.style.color = "#230de5"; link.textContent=title.concat("-MP4"); getAllMusicURL2(item).then(result=>{ playurl=result?.toString(); return playurl; }).then(data=>{console.log(link.href=data)}); container.append(link); },2000); } async function getAllMusicURL2(item) { function decrypt(t) { return CryptoJS.AES.decrypt({ ciphertext: CryptoJS.enc.Base64url.parse(t) }, CryptoJS.enc.Hex.parse('aaad3e4fd540b0f79dca95606e72bf93'), { mode: CryptoJS.mode.ECB, padding: CryptoJS.pad.Pkcs7 }).toString(CryptoJS.enc.Utf8); } var res = null; var ares = null; const timestamp = Date.parse(new Date()); var url = `https://www.ximalaya.com/mobile-playpage/track/v3/baseInfo/${timestamp}?device=web&trackId=${item.id}&forVideo=true&needMp4=true`; var aurl =`https://www.ximalaya.com/mobile-playpage/track/v3/baseInfo/${timestamp}?device=web&trackId=${item.id}`; $.ajax({ type: 'get', url: aurl, async: false, dataType: "json", success: function(resp) { try { ares = decrypt(resp.trackInfo.playUrlList[0].url); } catch (e) { console.log("无效"); } } }); $.ajax({ type: 'get', url: url, async: false, dataType: "json", success: function(resp) { try { res = decrypt(resp.trackInfo.playUrlList[0].url); } catch (e) { console.log("解密错误,无视频"); res=ares; } } }); return res; } } //获取专辑列表 // https://www.ximalaya.com/revision/album/v1/getTracksList?albumId=77545064&pageNum=1&pageSize=100 if (location.pathname.includes("/album/")){ var alt=[]; var ttls=[]; var abid=location.pathname.includes("/album/") ? location.pathname.split("/")[2] : "77545064"; var abapi=`https://www.ximalaya.com/revision/album/v1/getTracksList?albumId=${abid}&pageNum=1&pageSize=100`; fetch(abapi,{method:"get"}) .then(res=>{return res?.json()}) .then(res=>{ var tracks=res?.data?.tracks; tracks.forEach(i=>{ /*alt.push(i.url.split("/")[2]);ttls.push(i.title);*/ alt.push(i.url);ttls.push(i.title); }) }) .then(function(){ if (document.querySelector("div.download-more")){ document.querySelector("div.download-more").remove(); } document.querySelector(".sound-list>ul").innerHTML=null; document.querySelector(".sound-list>ul").style.listStyle = 'decimal'; ttls.forEach((it,n)=>{ console.log(it,n); var ulli=document.createElement("li"); var plink=document.createElement("a"); plink.href=alt[n]; plink.target="_blank"; plink.style.color="#088"; plink.style.fontSize="20px"; plink.textContent=it; ulli.append(plink); document.querySelector(".sound-list>ul").append(ulli); }); }); } })();
QingJ © 2025
镜像随时可能失效,请加Q群300939539或关注我们的公众号极客氢云获取最新地址