New Userscript

try to take over the world!

  1. // ==UserScript==
  2. // @name New Userscript
  3. // @namespace http://tampermonkey.net/
  4. // @version 0.1
  5. // @description try to take over the world!
  6. // @author You
  7. // @match https://music.163.com/*
  8. // @grant GM_xmlhttpRequest
  9. // @require http://libs.baidu.com/jquery/2.0.0/jquery.min.js
  10. // ==/UserScript==
  11. /*
  12. * GreasyFork不允许的库,直接代码贴进来
  13. */
  14. (function () {
  15. let c = [];
  16. //#g_player > div.head.j-flag > a
  17. //&encSecKey=70af33c020a8543f0028c8e83bb03794dbaf27fc991b7544cee6f309d41d5713548e8d8fb4859831f2ffe92320d07a15fb6a041887c297b1ffc4e5b04b9d1cbc07ee6271d7dd2dcbf1c0b742081d36b72f3118b00a5d720a9b82811b0cfce0efc6c1e57a0cef437a00406afa19768a5d6341773497675cdb3fe424eab374429e
  18. $("#content-operation").append("<button class='u-btni u-btni-share ' style='color: blue' id='myurl'>下载歌曲</button>");
  19. $("#myurl").click(function () {
  20. const id = getQueryString("id");
  21. encrypted_request(id);
  22. getMusicLink(c)
  23. });
  24. // encText=str({'ids': "[" + str(id) + "]", 'br': 128000, 'csrf_token': ""})#i8a
  25. //获取get传值的方法
  26. function getQueryString(name) {
  27. var reg = new RegExp("(^|&)" + name + "=([^&]*)(&|$)");
  28. var r = window.location.search.substr(1).match(reg);
  29. if (r != null) return decodeURI(r[2]);
  30. return null;
  31. }
  32.  
  33. //产生16位随机数
  34. function r(e) {
  35. var t, n, r = "abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789", o = "";
  36. for (t = 0; e > t; t += 1)
  37. n = Math.random() * r.length,
  38. n = Math.floor(n),
  39. o += r.charAt(n);
  40. return o
  41. }
  42.  
  43. function o(e, t) {
  44. //aes 加密
  45. var n = CryptoJS.enc.Utf8.parse(t)
  46. , r = CryptoJS.enc.Utf8.parse("0102030405060708")
  47. , o = CryptoJS.enc.Utf8.parse(e);
  48. return CryptoJS.AES.encrypt(o, n, {
  49. iv: r,
  50. mode: CryptoJS.mode.CBC
  51. }).toString()
  52. }
  53.  
  54. function i(e, t, n) {
  55. var r;
  56. setMaxDigits(256);
  57. r = new RSAKeyPair(t, "", n);
  58. let text = encryptedString(r, e)
  59. return text
  60. }
  61. function getMusicLink(c){
  62. GM_xmlhttpRequest({
  63. method: 'POST',
  64. url: 'https://music.163.com/weapi/song/enhance/player/url?csrf_token=',
  65. headers: {
  66. 'Accept':'*/*',
  67. 'Accept-Encoding':'gzip, deflate',
  68. 'Accept-Language':'zh-CN,zh;q=0.8',
  69. 'Connection':'keep-alive',
  70. 'Content-Type':'application/x-www-form-urlencoded',
  71. 'Host':'music.163.com',
  72. 'Origin':'http://music.163.com',
  73. 'Referer':'http://music.163.com/',
  74. 'User-Agent':'Mozilla/5.0 (Macintosh; Intel Mac OS X 10_9_2) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/33.0.1750.152 Safari/537.36',
  75. 'Cookie': document.cookie + ';os=pc'
  76. },
  77. data: "params="+c.encText+"&encSecKey="+c.encSecKey,
  78. onreadystatechange: function(res) {
  79. if (res.readyState == 4) {
  80. if (res.status == 200) {
  81. var o=JSON.parse(res.response);
  82. window.open(o.data[0].url, '_blank');
  83.  
  84. }
  85. }
  86. }
  87. });
  88. }
  89. // //const modulus = "00e0b509f6259df8642dbc35662901477df22677ec152b5ff68ace615bb7b725152b3ab17a876aea8a5aa76d2e417629ec4ee341f56135fccf695280104e0312ecbda92557c93870114af6c9d05c4f7f0c3685b7a46bee255932575cce10b424d813cfe4875d3e82047b97ddef52741d546b8e289dc6935b3ece0462db0a22b8e7"
  90. // const nonce = "0CoJUm6Qyw8W8jud"
  91. // const pubKey = "010001"
  92. // const keys = "abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789+/"
  93. // const iv = "0102030405060708"
  94. var modulus = '00e0b509f6259df8642dbc35662901477df22677ec152b5ff68ace615bb7' +
  95. 'b725152b3ab17a876aea8a5aa76d2e417629ec4ee341f56135fccf695280' +
  96. '104e0312ecbda92557c93870114af6c9d05c4f7f0c3685b7a46bee255932' +
  97. '575cce10b424d813cfe4875d3e82047b97ddef52741d546b8e289dc6935b' +
  98. '3ece0462db0a22b8e7';
  99. var nonce = '0CoJUm6Qyw8W8jud';
  100. var pubKey = '010001';
  101.  
  102. function createSecretKey(size) {
  103. return (Math.random().toString(16).substring(2) + Math.random().toString(16).substring(2)).substring(0, 16);
  104. }
  105.  
  106. function aesEncrypt(text, secKey) {
  107. secKey = CryptoJS.enc.Utf8.parse(secKey);
  108. text = CryptoJS.enc.Utf8.parse(text);
  109. var encrypted = CryptoJS.AES.encrypt(text, secKey, {
  110. iv: CryptoJS.enc.Utf8.parse('0102030405060708'),
  111. mode: CryptoJS.mode.CBC
  112. });
  113. encrypted = encrypted.toString();
  114. return encrypted;
  115. }
  116.  
  117. function rsaEncrypt(text, pubKey, modulus) {
  118. setMaxDigits(256);
  119. var keys = new RSAKeyPair(pubKey, "", modulus);
  120. var encText = encryptedString(keys, text);
  121. return encText;
  122. }
  123.  
  124. function encrypted_request(text) {
  125. text = '{"ids": [' + text + '], "br": 320000, "csrf_token": ""}';
  126. var secKey = r(16);
  127. var encText = aesEncrypt(aesEncrypt(text, nonce), secKey);
  128. var encSecKey = rsaEncrypt(secKey, pubKey, modulus);
  129. // var data = 'params=' + encodeURIComponent(encText) + '&encSecKey=' + encodeURIComponent(encSecKey);
  130. return c.encText = encodeURIComponent(encText), c.encSecKey = encodeURIComponent(encSecKey);
  131. }
  132. })();

QingJ © 2025

镜像随时可能失效,请加Q群300939539或关注我们的公众号极客氢云获取最新地址