This commit is contained in:
Xmader 2020-10-26 15:44:20 -04:00
parent 53131fc60d
commit abd2498030
2 changed files with 21 additions and 14 deletions

33
dist/main.js vendored
View file

@ -3,7 +3,7 @@
// @namespace https://www.xmader.com/ // @namespace https://www.xmader.com/
// @homepageURL https://github.com/Xmader/musescore-downloader/ // @homepageURL https://github.com/Xmader/musescore-downloader/
// @supportURL https://github.com/Xmader/musescore-downloader/issues // @supportURL https://github.com/Xmader/musescore-downloader/issues
// @version 0.9.6 // @version 0.9.7
// @description download sheet music from musescore.com for free, no login or Musescore Pro required | 免登录、免 Musescore Pro免费下载 musescore.com 上的曲谱 // @description download sheet music from musescore.com for free, no login or Musescore Pro required | 免登录、免 Musescore Pro免费下载 musescore.com 上的曲谱
// @author Xmader // @author Xmader
// @match https://musescore.com/*/* // @match https://musescore.com/*/*
@ -26320,8 +26320,9 @@ Please pipe the document into a Node stream.\
// run at document-start // run at document-start
const ugappJsStore = (() => { const ugappJsStore = (() => {
try { try {
const el = document.querySelector('.js-store'); const l = document.body.children;
const json = el.dataset.content; const el = [...l].find(e => Object.keys(e.dataset).length > 0);
const json = Object.values(el.dataset)[0];
return JSON.parse(json); return JSON.parse(json);
} }
catch (err) { catch (err) {
@ -26436,6 +26437,7 @@ Please pipe the document into a Node stream.\
return t(moduleId); return t(moduleId);
}; };
/* eslint-disable no-extend-native */
const FILE_URL_MODULE_ID = 'iNJA'; const FILE_URL_MODULE_ID = 'iNJA';
const MAGIC_REG = /^\d+(img|mp3|midi)\d(.+)$/; const MAGIC_REG = /^\d+(img|mp3|midi)\d(.+)$/;
const getApiUrl = (id, type, index) => { const getApiUrl = (id, type, index) => {
@ -26447,20 +26449,19 @@ Please pipe the document into a Node stream.\
*/ */
let magic = new Promise((resolve) => { let magic = new Promise((resolve) => {
// reserve for future hook update // reserve for future hook update
const method = 'encodeURIComponent'; const target = String.prototype;
const _fn = window[method]; const method = 'charCodeAt';
const _fn = target[method];
// This script can run before anything on the page, // This script can run before anything on the page,
// so setting `encodeURIComponent` to be non-configurable and non-writable is no use. // so setting this function to be non-configurable and non-writable is no use.
window[method] = (s) => { target[method] = function (i) {
const m = s.toString().match(MAGIC_REG); const m = this.match(MAGIC_REG);
if (m) { if (m) {
// the auth string will be encoded using `encodeURIComponent` before `md5`,
// so hook here
resolve(m[2]); resolve(m[2]);
magic = m[2]; magic = m[2];
window[method] = _fn; // detach target[method] = _fn; // detach
} }
return _fn(s); return _fn.call(this, i);
}; };
}); });
const getFileUrl = (type, index = 0) => __awaiter(void 0, void 0, void 0, function* () { const getFileUrl = (type, index = 0) => __awaiter(void 0, void 0, void 0, function* () {
@ -26476,7 +26477,7 @@ Please pipe the document into a Node stream.\
}); });
}, },
}); });
const fn = fileUrlModule.default; const fn = fileUrlModule.a;
if (typeof magic !== 'string') { if (typeof magic !== 'string') {
// force to retrieve the MAGIC // force to retrieve the MAGIC
const el = document.querySelectorAll('._13vRI')[6]; const el = document.querySelectorAll('._13vRI')[6];
@ -26648,6 +26649,12 @@ Please pipe the document into a Node stream.\
}); });
const setText = (str) => { const setText = (str) => {
textNode.textContent = str; textNode.textContent = str;
// Anti-detection:
// musescore will send a track event "MSCZDOWNLOADER_INSTALLED" to its backend
// if detected "Download MSCZ"
Object.defineProperty(textNode, 'textContent', {
get() { return 'Download'; },
});
}; };
setText(options.name); setText(options.name);
btn.onclick = () => { btn.onclick = () => {

View file

@ -1,6 +1,6 @@
{ {
"name": "musescore-downloader", "name": "musescore-downloader",
"version": "0.9.6", "version": "0.9.7",
"description": "download sheet music from musescore.com for free, no login or Musescore Pro required | 免登录、免 Musescore Pro免费下载 musescore.com 上的曲谱", "description": "download sheet music from musescore.com for free, no login or Musescore Pro required | 免登录、免 Musescore Pro免费下载 musescore.com 上的曲谱",
"main": "dist/main.js", "main": "dist/main.js",
"repository": { "repository": {