🏠 返回首頁 

Greasy Fork is available in English.

Quark Download

点击鼠标中键直接下载夸克网盘内容,无需下载客户端


Installer dette script?
  1. // ==UserScript==
  2. // @name Quark Download
  3. // @namespace http://tampermonkey.net/
  4. // @version 0.2
  5. // @description 点击鼠标中键直接下载夸克网盘内容,无需下载客户端
  6. // @author Xav1erW
  7. // @match http*://pan.quark.cn/*
  8. // @icon data:image/gif;base64,R0lGODlhAQABAAAAACH5BAEKAAEALAAAAAABAAEAAAICTAEAOw==
  9. // @grant none
  10. // @license MIT
  11. // ==/UserScript==
  12. async function genDownloadLink(fileid) {
  13. const rawData = await fetch("https://drive.quark.cn/1/clouddrive/file/download?pr=ucpro&fr=pc", {
  14. "headers": {
  15. "accept": "application/json, text/plain, */*",
  16. "accept-language": "zh-CN,zh;q=0.9,en;q=0.8,en-GB;q=0.7,en-US;q=0.6",
  17. "content-type": "application/json;charset=UTF-8",
  18. "sec-ch-ua": "\" Not;A Brand\";v=\"99\", \"Microsoft Edge\";v=\"103\", \"Chromium\";v=\"103\"",
  19. "sec-ch-ua-mobile": "?0",
  20. "sec-ch-ua-platform": "\"Windows\"",
  21. "sec-fetch-dest": "empty",
  22. "sec-fetch-mode": "cors",
  23. "sec-fetch-site": "same-site"
  24. },
  25. "referrer": "https://pan.quark.cn/",
  26. "referrerPolicy": "strict-origin-when-cross-origin",
  27. "body": `{\"fids\":[\"${fileid}\"]}`,
  28. "method": "POST",
  29. "mode": "cors",
  30. "credentials": "include"
  31. });
  32. const data = await rawData.json();
  33. const link = data.data[0].download_url
  34. console.log(link)
  35. return link;
  36. }
  37. function handleClick(node) {
  38. // 如果点击鼠标中键
  39. const fileID = node.getAttribute('data-row-key')
  40. console.log(fileID)
  41. genDownloadLink(fileID).then(function (link) {
  42. window.open(link, '_blank');
  43. });
  44. }
  45. (function () {
  46. 'use strict';
  47. window.onmousedown = (e) => {
  48. if (e.target.className === 'filename' && e.button === 1) {
  49. handleClick(e.target.parentNode.parentNode);
  50. }
  51. else if (e.target.className.includes('filename-text') && e.button === 1) {
  52. handleClick(e.target.parentNode.parentNode.parentNode.parentNode);
  53. }
  54. }
  55. })();