QQ音乐网页版下载 tampermonkey(油猴)下载脚本

左上角下载当前播放歌曲

右上角下载播放列表全部音乐

// ==UserScript==
// @name         Get Song Info and Download All
// @namespace    http://tampermonkey.net/
// @version      1.0
// @description  Get current playing song and artist and download all songs in the playlist
// @author       Eadny
// @match        *://y.qq.com/n/ryqq/player*
// @grant        GM_addStyle
// @grant        GM_xmlhttpRequest
// ==/UserScript==

(function() {
    'use strict';
    var allDownloadButton = document.createElement("button");
    allDownloadButton.innerHTML = "全部下载";
    allDownloadButton.id = "allDownloadButton"; 
    document.body.appendChild(allDownloadButton);
    GM_addStyle(`
        #allDownloadButton {
            position: fixed;
            right: 0;
            top: 0;
            z-index: 9999; 
        }
    `);
    var isDownloading = false; 
    allDownloadButton.addEventListener("click", function() {
        if (!isDownloading) {
            isDownloading = true;
            downloadAllSongs();
        }
    });
    function downloadAllSongs() {
        var songInfoList = [];
        function downloadNextSong() {
            var songNameElement = document.querySelector('.song_info__name a');
            var artistElement = document.querySelector('.song_info__singer a');
            var songName = songNameElement ? songNameElement.innerText : "未找到歌曲名字";
            var artist = artistElement ? artistElement.innerText : "未找到歌手名字";
            var audioElement = document.querySelector('audio');
            var songUrl = audioElement ? audioElement.src : "未找到歌曲链接";
            var fileName = songName + '-' + artist + '.mp3';
            songInfoList.push({ songName, artist, songUrl });
            GM_xmlhttpRequest({
                method: "GET",
                url: songUrl,
                responseType: "blob",
                onload: function(response) {
                    var blob = response.response;
                    var link = document.createElement("a");
                    link.href = window.URL.createObjectURL(blob);
                    link.download = fileName;
                    document.body.appendChild(link);
                    link.click();
                    document.body.removeChild(link);
                    var nextButton = document.querySelector('.btn_big_next');
                    if (nextButton) {
                        nextButton.click();
                        if (isDuplicate(songInfoList[songInfoList.length - 1], songInfoList.slice(0, -1))) {
                            isDownloading = false;
                            alert('全部歌曲下载完成');
                        } else {
                            downloadNextSong();
                        }
                    }
                },
            });
        }
        downloadNextSong();
    }
    function isDuplicate(currentSong, songList) {
        return songList.some(song => song.songName === currentSong.songName && song.artist === currentSong.artist && song.songUrl === currentSong.songUrl);
    }
    var button = document.createElement("button");
    button.innerHTML = "下载";
    button.id = "getSongInfoButton"; 
    document.body.appendChild(button);
    GM_addStyle(`
        #getSongInfoButton {
            position: fixed;
            left: 0;
            top: 0;
            z-index: 9999; 
        }
    `);
    button.addEventListener("click", function() {
        var songNameElement = document.querySelector('.song_info__name a');
        var artistElement = document.querySelector('.song_info__singer a');
        var songName = songNameElement ? songNameElement.innerText : "未找到歌曲名字";
        var artist = artistElement ? artistElement.innerText : "未找到歌手名字";
        var audioElement = document.querySelector('audio');
        var songUrl = audioElement ? audioElement.src : "未找到歌曲链接";
        var fileName = songName + '-' + artist + '.mp3';
        GM_xmlhttpRequest({
            method: "GET",
            url: songUrl,
            responseType: "blob",
            onload: function(response) {
                var blob = response.response;
                var link = document.createElement("a");
                link.href = window.URL.createObjectURL(blob);
                link.download = fileName;
                document.body.appendChild(link);
                link.click();
                document.body.removeChild(link);
            },
        });
    });

})();

### QQ音乐 19.51 版本的下载方法 要获取特定版本的软件,例如 QQ 音乐 19.51 的旧版安装包,通常可以通过以下几种方式实现: #### 方法一:通过第三方应用市场 一些知名的第三方应用分发平台可能会保留历史版本的应用程序。可以尝试访问这些网站并搜索目标版本号。需要注意的是,在下载前务必确认该站点的安全性和合法性[^3]。 #### 方法二:利用官方渠道寻找旧版本 腾讯公司可能不会直接提供过期版本的链接,但在某些特殊情况下,部分资源仍可通过其服务器间接获得。如果无法在线寻获,则可考虑联系客服咨询是否有合法途径取得所需版本[^4]。 #### 方法三:借助存档工具或社区分享 互联网上存在专门用于保存网页快照及文件的历史记录服务(如 Wayback Machine),有时也能从中发现已下架的老版本应用程序。另外,技术爱好者论坛或者社交媒体群组里也可能有人愿意共享此类稀缺资料[^5]。 以下是 Python 脚本示例代码片段展示如何模拟请求过程来查找指定URL下的可用资源列表: ```python import requests from bs4 import BeautifulSoup def fetch_versions(url): response = requests.get(url) soup = BeautifulSoup(response.text, 'html.parser') versions_links = [] for link in soup.find_all('a'): href = link.get('href') if "qqmusic" in href and ".exe" in href: versions_links.append(href) return versions_links url_to_check = "http://example.com/archive/" # 替换为实际网址 print(fetch_versions(url_to_check)) ```
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值