您需要先安装一个扩展,例如 篡改猴、Greasemonkey 或 暴力猴,之后才能安装此脚本。
您需要先安装一个扩展,例如 篡改猴 或 暴力猴,之后才能安装此脚本。
您需要先安装一个扩展,例如 篡改猴 或 暴力猴,之后才能安装此脚本。
您需要先安装一个扩展,例如 篡改猴 或 Userscripts ,之后才能安装此脚本。
您需要先安装一款用户脚本管理器扩展,例如 Tampermonkey,才能安装此脚本。
您需要先安装用户脚本管理器扩展后才能安装此脚本。
download weixin.qq.com audio
当前为
// ==UserScript== // @name 公众号音频下载(新) // @namespace http://tampermonkey.net/ // @version 1.1 // @description download weixin.qq.com audio // @author Bingo8670 // @match https://mp.weixin.qq.com/ // @grant none // @license MIT // ==/UserScript== (function() { 'use strict'; function addDownloadButton(audio) { // 防止重复添加 if (audio.dataset.downloadButtonInjected) return; audio.dataset.downloadButtonInjected = "true"; let fileid = audio.getAttribute('voice_encode_fileid'); let title = audio.getAttribute('name') || 'audio'; let url = 'https://res.wx.qq.com/voice/getvoice?mediaid=' + fileid; let btn = document.createElement('div'); btn.style = ` display:inline-block; margin-top:10px; padding:10px 15px; background:#4CAF50; color:#fff; font-size:14px; text-align:center; border-radius:5px; cursor:pointer; box-shadow:0 2px 5px rgba(0,0,0,0.2); `; btn.innerHTML = "下载音频 “" + title + "”"; btn.onclick = function() { GM_download({ url: url, name: title + '.mp3', saveAs: true }); }; audio.after(btn); } function scanAndInject() { let audios = document.querySelectorAll('mp-common-mpaudio'); audios.forEach(addDownloadButton); } // 初始执行一次 scanAndInject(); // 监听 DOM 变化 const observer = new MutationObserver(() => { scanAndInject(); }); observer.observe(document.body, { childList: true, subtree: true }); })();