v0.15.6
This commit is contained in:
parent
4764e0931b
commit
ee518dc8f3
|
@ -5,7 +5,7 @@
|
||||||
// @supportURL https://github.com/Xmader/musescore-downloader/issues
|
// @supportURL https://github.com/Xmader/musescore-downloader/issues
|
||||||
// @updateURL https://msdl.librescore.org/install.user.js
|
// @updateURL https://msdl.librescore.org/install.user.js
|
||||||
// @downloadURL https://msdl.librescore.org/install.user.js
|
// @downloadURL https://msdl.librescore.org/install.user.js
|
||||||
// @version 0.15.5
|
// @version 0.15.6
|
||||||
// @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/*/*
|
||||||
|
@ -26411,7 +26411,7 @@ Please pipe the document into a Node stream.\
|
||||||
return `/ipns/${IPNS_KEY}/${this.idLastDigit}/${this.id}.mscz`;
|
return `/ipns/${IPNS_KEY}/${this.idLastDigit}/${this.id}.mscz`;
|
||||||
},
|
},
|
||||||
get msczCidUrl() {
|
get msczCidUrl() {
|
||||||
return `https://ipfs.infura.io:5001/api/v0/dag/resolve?arg=${this.msczIpfsRef}`;
|
return `https://ipfs.infura.io:5001/api/v0/block/stat?arg=${this.msczIpfsRef}`;
|
||||||
},
|
},
|
||||||
get sheetImgType() {
|
get sheetImgType() {
|
||||||
try {
|
try {
|
||||||
|
@ -26475,47 +26475,10 @@ Please pipe the document into a Node stream.\
|
||||||
|
|
||||||
/* eslint-disable @typescript-eslint/no-unsafe-return */
|
/* eslint-disable @typescript-eslint/no-unsafe-return */
|
||||||
const CHUNK_PUSH_FN = /^function [^r]\(\w\){/;
|
const CHUNK_PUSH_FN = /^function [^r]\(\w\){/;
|
||||||
const moduleLookup = (id, globalWebpackJson) => {
|
|
||||||
const pack = globalWebpackJson.find(x => x[1][id]);
|
|
||||||
return pack[1][id];
|
|
||||||
};
|
|
||||||
/**
|
|
||||||
* Retrieve (webpack_require) a module from the page's webpack package
|
|
||||||
*
|
|
||||||
* I know this is super hacky.
|
|
||||||
*/
|
|
||||||
const webpackHook = (moduleId, moduleOverrides = {}, globalWebpackJson = window['webpackJsonpmusescore']) => {
|
|
||||||
const t = Object.assign((id, override = true) => {
|
|
||||||
const r = {};
|
|
||||||
const m = (override && moduleOverrides[id])
|
|
||||||
? moduleOverrides[id]
|
|
||||||
: moduleLookup(id, globalWebpackJson);
|
|
||||||
m(r, r, t);
|
|
||||||
if (r.exports)
|
|
||||||
return r.exports;
|
|
||||||
return r;
|
|
||||||
}, {
|
|
||||||
d(exp, name, fn) {
|
|
||||||
return Object.prototype.hasOwnProperty.call(exp, name) ||
|
|
||||||
Object.defineProperty(exp, name, { enumerable: true, get: fn });
|
|
||||||
},
|
|
||||||
n(e) {
|
|
||||||
const m = e.__esModule ? () => e.default : () => e;
|
|
||||||
t.d(m, 'a', m);
|
|
||||||
return m;
|
|
||||||
},
|
|
||||||
r(r) {
|
|
||||||
Object.defineProperty(r, '__esModule', { value: true });
|
|
||||||
},
|
|
||||||
e() {
|
|
||||||
return Promise.resolve();
|
|
||||||
},
|
|
||||||
});
|
|
||||||
return t(moduleId);
|
|
||||||
};
|
|
||||||
const ALL = '*';
|
const ALL = '*';
|
||||||
const webpackGlobalOverride = (() => {
|
const [webpackGlobalOverride, onPackLoad] = (() => {
|
||||||
const moduleOverrides = {};
|
const moduleOverrides = {};
|
||||||
|
const onPackLoadFns = [];
|
||||||
function applyOverride(pack) {
|
function applyOverride(pack) {
|
||||||
let entries = Object.entries(moduleOverrides);
|
let entries = Object.entries(moduleOverrides);
|
||||||
// apply to all
|
// apply to all
|
||||||
|
@ -26550,6 +26513,7 @@ Please pipe the document into a Node stream.\
|
||||||
hooked = true;
|
hooked = true;
|
||||||
hookNative(v, 'push', (_fn) => {
|
hookNative(v, 'push', (_fn) => {
|
||||||
return function (pack) {
|
return function (pack) {
|
||||||
|
onPackLoadFns.forEach(fn => fn(pack));
|
||||||
applyOverride(pack);
|
applyOverride(pack);
|
||||||
return _fn.call(this, pack);
|
return _fn.call(this, pack);
|
||||||
};
|
};
|
||||||
|
@ -26557,54 +26521,64 @@ Please pipe the document into a Node stream.\
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
});
|
});
|
||||||
// set overrides
|
return [
|
||||||
return (moduleId, override) => {
|
// set overrides
|
||||||
moduleOverrides[moduleId] = override;
|
(moduleId, override) => {
|
||||||
};
|
moduleOverrides[moduleId] = override;
|
||||||
|
},
|
||||||
|
// set onPackLoad listeners
|
||||||
|
(fn) => {
|
||||||
|
onPackLoadFns.push(fn);
|
||||||
|
},
|
||||||
|
];
|
||||||
})();
|
})();
|
||||||
|
const webpackContext = new Promise((resolve) => {
|
||||||
|
webpackGlobalOverride(ALL, (n, r, t) => {
|
||||||
|
resolve(t);
|
||||||
|
});
|
||||||
|
});
|
||||||
|
|
||||||
/* eslint-disable no-extend-native */
|
/* eslint-disable no-extend-native */
|
||||||
let authModuleId;
|
const AUTH_REG = /[0-9a-f]{40}/;
|
||||||
const AUTH_FN = '+3],22,-1044525330)';
|
var PACK_ID;
|
||||||
const MAGIC_ARG_INDEX = 1;
|
(function (PACK_ID) {
|
||||||
|
PACK_ID[PACK_ID["img"] = 9] = "img";
|
||||||
|
PACK_ID[PACK_ID["midi"] = 118] = "midi";
|
||||||
|
PACK_ID[PACK_ID["mp3"] = 74] = "mp3";
|
||||||
|
})(PACK_ID || (PACK_ID = {}));
|
||||||
/**
|
/**
|
||||||
* I know this is super hacky.
|
* I know this is super hacky.
|
||||||
*/
|
*/
|
||||||
let magic = new Promise((resolve) => {
|
const magicHookConstr = (type) => {
|
||||||
// todo: hook module by what it does, not what it is called
|
// request pack
|
||||||
webpackGlobalOverride(ALL, (n, r, t) => {
|
// eslint-disable-next-line no-void, @typescript-eslint/no-unsafe-return
|
||||||
const fn = n.exports;
|
void webpackContext.then((ctx) => ctx.e(PACK_ID[type])).then(console.log);
|
||||||
if (typeof fn === 'function' && fn.toString().includes(AUTH_FN)) {
|
return new Promise((resolve) => {
|
||||||
if (!authModuleId && n.i) {
|
onPackLoad((pack) => {
|
||||||
authModuleId = n.i;
|
if (pack[0].includes(PACK_ID[type])) {
|
||||||
n.exports = (...args) => {
|
Object.values(pack[1]).forEach((mod) => {
|
||||||
if (magic instanceof Promise) {
|
const m = mod.toString().match(AUTH_REG);
|
||||||
magic = args[MAGIC_ARG_INDEX];
|
if (m && m[0])
|
||||||
resolve(magic);
|
resolve(m[0]);
|
||||||
}
|
});
|
||||||
return fn(...args);
|
|
||||||
};
|
|
||||||
}
|
}
|
||||||
}
|
});
|
||||||
});
|
});
|
||||||
});
|
};
|
||||||
|
const magics = {
|
||||||
|
img: magicHookConstr('img'),
|
||||||
|
midi: magicHookConstr('midi'),
|
||||||
|
mp3: magicHookConstr('mp3'),
|
||||||
|
};
|
||||||
const getApiUrl = (type, index) => {
|
const getApiUrl = (type, index) => {
|
||||||
return `/api/jmuse?id=${scoreinfo.id}&type=${type}&index=${index}`;
|
return `/api/jmuse?id=${scoreinfo.id}&type=${type}&index=${index}&v2=1`;
|
||||||
};
|
};
|
||||||
const getApiAuth = (type, index) => __awaiter(void 0, void 0, void 0, function* () {
|
const getApiAuth = (type, index) => __awaiter(void 0, void 0, void 0, function* () {
|
||||||
if (magic instanceof Promise) {
|
return magics[type];
|
||||||
// force to retrieve the MAGIC
|
|
||||||
const el = document.querySelectorAll('.SD7H- > button')[3];
|
|
||||||
el.click();
|
|
||||||
magic = yield magic;
|
|
||||||
}
|
|
||||||
const str = String(scoreinfo.id) + type + String(index);
|
|
||||||
const fn = webpackHook(authModuleId);
|
|
||||||
return fn(str, magic);
|
|
||||||
});
|
});
|
||||||
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* () {
|
||||||
const url = getApiUrl(type, index);
|
const url = getApiUrl(type, index);
|
||||||
const auth = yield getApiAuth(type, index);
|
const auth = yield getApiAuth(type);
|
||||||
const r = yield fetch(url, {
|
const r = yield fetch(url, {
|
||||||
headers: {
|
headers: {
|
||||||
Authorization: auth,
|
Authorization: auth,
|
||||||
|
@ -26648,8 +26622,8 @@ Please pipe the document into a Node stream.\
|
||||||
const url = scoreinfo.msczCidUrl;
|
const url = scoreinfo.msczCidUrl;
|
||||||
msczBufferP = (() => __awaiter(void 0, void 0, void 0, function* () {
|
msczBufferP = (() => __awaiter(void 0, void 0, void 0, function* () {
|
||||||
const r0 = yield fetch(url);
|
const r0 = yield fetch(url);
|
||||||
const { Cid: { '/': cid } } = yield r0.json();
|
const { Key } = yield r0.json();
|
||||||
const r = yield fetch(`https://ipfs.infura.io/ipfs/${cid}`);
|
const r = yield fetch(`https://ipfs.infura.io/ipfs/${Key}`);
|
||||||
const data = yield r.arrayBuffer();
|
const data = yield r.arrayBuffer();
|
||||||
return data;
|
return data;
|
||||||
}))();
|
}))();
|
||||||
|
|
|
@ -1,6 +1,6 @@
|
||||||
{
|
{
|
||||||
"name": "musescore-downloader",
|
"name": "musescore-downloader",
|
||||||
"version": "0.15.5",
|
"version": "0.15.6",
|
||||||
"lockfileVersion": 1,
|
"lockfileVersion": 1,
|
||||||
"requires": true,
|
"requires": true,
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
|
|
|
@ -1,6 +1,6 @@
|
||||||
{
|
{
|
||||||
"name": "musescore-downloader",
|
"name": "musescore-downloader",
|
||||||
"version": "0.15.5",
|
"version": "0.15.6",
|
||||||
"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": {
|
||||||
|
|
Loading…
Reference in New Issue