🏠 Home 

微信公众号超清视频下载

2023/12/6 19:13:26


Install this script?
  1. // ==UserScript==
  2. // @name 微信公众号超清视频下载
  3. // @namespace 微信公众号文章超清视频播放和下载
  4. // @match https://mp.weixin.qq.com/s/*
  5. // @grant none
  6. // @version 1.0.0
  7. // @icon https://res.wx.qq.com/a/wx_fed/assets/res/NTI4MWU5.ico
  8. // @author Jack.Chan (971546@qq.com)
  9. // @namespace http://fulicat.com
  10. // @url https://greasyfork.org/zh-CN/scripts/481530
  11. // @license MIT
  12. // @description 2023/12/6 19:13:26
  13. // ==/UserScript==
  14. (function() {
  15. // block contextmenu event
  16. var addEvent = EventTarget.prototype.addEventListener;
  17. EventTarget.prototype.addEventListener = function(type, fn, capture) {
  18. if (type !== 'contextmenu') {
  19. this.addEvent = addEvent;
  20. this.addEvent(type, fn, capture);
  21. }
  22. }
  23. function init() {
  24. var $players = document.querySelectorAll('.mp-video-player');
  25. $players.forEach((item) => {
  26. ((el) => {
  27. console.log('vInfo', el.__vue__.__vInfo);
  28. el.vInfo = el.__vue__.__vInfo;
  29. if (el.vInfo?.dynamicData?.data?.totalUrl) {
  30. el.totalUrl = el.vInfo?.dynamicData?.data?.totalUrl;
  31. }
  32. // remove mask
  33. el.$mask = el.querySelector('.video_mask');
  34. if (el.$mask) {
  35. el.$mask.parentNode.removeChild(el.$mask);
  36. }
  37. el.$video = el.querySelector('video');
  38. if (el.$video && el.totalUrl) {
  39. // set SD video
  40. el.$video.src = el.totalUrl;
  41. // add download button
  42. el.$download = document.createElement('a');
  43. el.$download.setAttribute('href', el.totalUrl);
  44. el.$download.setAttribute('download', '');
  45. el.$download.setAttribute('onclick', 'return false');
  46. el.$download.style.cssText = 'position: absolute;top: 0;left: 0;z-index: 9999;display: inline-block;padding:5px 10px;color: #1890ff;background:rgba(255,255,255,0.92);';
  47. el.$download.innerText = '👉 超清视频下载 💾';
  48. el.$download.setAttribute('title', '请点击右键 在菜单中选择 链接另存为');
  49. el.$download.addEventListener('click', (event) => {
  50. event.preventDefault();
  51. alert(el.$download.getAttribute('title'));
  52. });
  53. el.insertBefore(el.$download, el.childNodes[0]);
  54. console.error('replaced')
  55. }
  56. })(item);
  57. });
  58. }
  59. setTimeout(() => {
  60. init();
  61. }, 500);
  62. })();