下载视频号步骤总体为两个步骤,首先抓包获取视频链接,最后将视频链接替换下可以直接下载,如果需要下载高清视频则需要删除链接中的多余参数。
操作方法
1、下载抓包工具,没有的去下载,链接: https://www.wdzzz.com/ruanjian/tools/1010.html
2、打开HTTP Debugger Pro后,再打开视频号对应的链接,可以看到的GET链接,如下图:
3、将以下代码保存到HTML文件并打开,随便复制一个抓包到的链接,用下面保存好的js代码去生成替换下链接,就可以直接得到下载链接了。
<!DOCTYPE html> <html> <head> <meta charset="UTF-8"/> <meta http-equiv="X-UA-Compatible" content="IE=edge"/> <meta name="viewport" content="width=device-width, initial-scale=1.0, maximum-scale=1.0, minimum-scale=1.0, user-scalable=no, viewport-fit=cover"/> <title>微信视频号视频下载</title> </head> <body> <textarea placeholder="请输入原始视频下载链接" style="width: 99%;max-width: 860px;min-height: 200px"></textarea> <p> <button>下载普通视频</button> <button>下载高清视频</button> </p> <p> <button>复制普通链接</button> <button>复制高清链接</button> </p> </body> <script> function copyToClipboard(text) { try { const textarea = document.createElement('textarea'); textarea.setAttribute('readonly', 'readonly'); textarea.value = text; document.body.appendChild(textarea); textarea.select(); let flag = document.execCommand('copy'); document.body.removeChild(textarea); return flag; } catch (e) { console.log(e); return false; } } let url1, url2; function parseWxVideoUrl(url) { let [baseUrl, search] = url.split("?", 2); const urlParams = new URLSearchParams(search); let encfilekey = urlParams.get("encfilekey"); let token = urlParams.get("token"); url1 = baseUrl.replace("/20302/", "/20304/") + "?" + search; return url1 + `?encfilekey=${encfilekey}&token=${token}`; } function downloadData(url, e) { let xhr = new XMLHttpRequest(); xhr.open('GET', url, true); xhr.responseType = 'blob'; xhr.onload = (e) => { let link = document.createElement('a'); link.href = URL.createObjectURL(xhr.response); link.download = "视频号视频.mp4"; link.click(); }; xhr.onprogress = (event) => { if (event.lengthComputable) { e.target.textContent = "下载" + (event.loaded * 100 / event.total).toFixed(1) + '%'; } }; xhr.send(); } function copyUrl(url, e) { let tmp = e.target.textContent; if (copyToClipboard(url)) e.target.textContent = "复制成功"; else e.target.textContent = "复制失败"; setTimeout(() => { e.target.textContent = tmp; }, 2000); } document.querySelector("button.down1").addEventListener("click", evt => downloadData(url1, evt)); document.querySelector("button.down2").addEventListener("click", evt => downloadData(url2, evt)); document.querySelector("button.copy1").addEventListener("click", (event) => copyUrl(url1, event)); document.querySelector("button.copy2").addEventListener("click", (event) => copyUrl(url2, event)); const textarea = document.querySelector('textarea'); textarea.addEventListener('input', (event) => { const modifiedText = event.target.value; url2 = parseWxVideoUrl(modifiedText); document.querySelector("button.down1").textContent = "下载普通视频"; document.querySelector("button.down2").textContent = "下载高清视频"; }); </script> </html>
最后处理完毕的链接为:
https://finder.video.qq.com/251/20304/stodownload?encfilekey=6xykWLEnztKcKCJZcV0rWCM8ua7DibZkibPSZaIgeFjxHdXG667ep3WWuicTxoCdZnevLoAMoPJS5xicCBvsMZ4TYxqCA0vybuNAz4RwPxu67GTtsLib2XImN1CrpAv3FAuB0czTp58wZwOPcSuZjgT57lO1lmruPIC1551fMeBs9I48&token=cztXnd9GyrFgWibaZnNzz3ALIdicHeF3jahXZf267DGXLT6NtRT2h8VY6NHiaZiaXeEMIhdy9ceeJRg53MCRaPkWlXImnibfYjGGWytqIqd1PHm8bS3weLFGKIiaXJoCpdHv5Q
点击下载高清视频会在前端后台下载完毕后弹出下载框。