v0.9.1 - #35
This commit is contained in:
parent
4fde5c3948
commit
4ed5b07f97
|
@ -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.0
|
// @version 0.9.1
|
||||||
// @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/*/*
|
||||||
|
@ -26367,49 +26367,66 @@ Please pipe the document into a Node stream.\
|
||||||
};
|
};
|
||||||
|
|
||||||
/* eslint-disable @typescript-eslint/no-unsafe-return */
|
/* eslint-disable @typescript-eslint/no-unsafe-return */
|
||||||
const AUTH_MODULE_ID = 'FNf8';
|
/* eslint-disable @typescript-eslint/explicit-module-boundary-types */
|
||||||
const getApiUrl = (type, index) => {
|
const moduleLookup = (id, globalWebpackJson) => {
|
||||||
// proxy
|
const pack = globalWebpackJson.find(x => x[1][id]);
|
||||||
return `https://musescore.now.sh/api/jmuse?id=${scoreinfo.id}&type=${type}&index=${index}`;
|
return pack[1][id];
|
||||||
};
|
};
|
||||||
/**
|
/**
|
||||||
* Retrieve (webpack_require) a module from the page's webpack package
|
* Retrieve (webpack_require) a module from the page's webpack package
|
||||||
*
|
*
|
||||||
* I know this is super hacky.
|
* I know this is super hacky.
|
||||||
*/
|
*/
|
||||||
const webpackHook = (moduleId, globalWebpackJson = window['webpackJsonpmusescore']) => {
|
const webpackHook = (moduleId, moduleOverrides = {}, globalWebpackJson = window['webpackJsonpmusescore']) => {
|
||||||
const pack = globalWebpackJson.find(x => x[1][moduleId]);
|
const t = Object.assign((id, override = true) => {
|
||||||
const t = Object.assign((id) => {
|
|
||||||
const r = {};
|
const r = {};
|
||||||
pack[1][id](r, r, t);
|
const m = (override && moduleOverrides[id])
|
||||||
|
? moduleOverrides[id]
|
||||||
|
: moduleLookup(id, globalWebpackJson);
|
||||||
|
m(r, r, t);
|
||||||
if (r.exports)
|
if (r.exports)
|
||||||
return r.exports;
|
return r.exports;
|
||||||
return r;
|
return r;
|
||||||
}, {
|
}, {
|
||||||
d(exp, name, fn) {
|
d(exp, name, fn) {
|
||||||
return Object.defineProperty(exp, name, { value: fn });
|
return Object.prototype.hasOwnProperty.call(exp, name) ||
|
||||||
|
Object.defineProperty(exp, name, { enumerable: true, get: fn });
|
||||||
},
|
},
|
||||||
n(e) {
|
n(e) {
|
||||||
return () => e;
|
return e.__esModule ? () => e.default : () => e;
|
||||||
|
},
|
||||||
|
r(r) {
|
||||||
|
Object.defineProperty(r, '__esModule', { value: true });
|
||||||
|
},
|
||||||
|
e() {
|
||||||
|
return Promise.resolve();
|
||||||
},
|
},
|
||||||
});
|
});
|
||||||
return t(moduleId);
|
return t(moduleId);
|
||||||
};
|
};
|
||||||
const getApiAuth = (type, index) => {
|
|
||||||
const authModule = webpackHook(AUTH_MODULE_ID);
|
const FILE_URL_MODULE_ID = 'iNJA';
|
||||||
const fn = authModule.a();
|
const getApiUrl = (id, type, index) => {
|
||||||
return fn(scoreinfo.id, type, index);
|
// proxy
|
||||||
|
return `https://musescore.now.sh/api/jmuse?id=${id}&type=${type}&index=${index}`;
|
||||||
};
|
};
|
||||||
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 fileUrlModule = webpackHook(FILE_URL_MODULE_ID, {
|
||||||
const auth = getApiAuth(type, index);
|
'6Ulw'(_, r, t) {
|
||||||
const r = yield fetch(url, {
|
t.d(r, 'a', () => {
|
||||||
headers: {
|
return type;
|
||||||
Authorization: auth,
|
});
|
||||||
|
},
|
||||||
|
'VSrV'(_, r, t) {
|
||||||
|
t.d(r, 'b', () => {
|
||||||
|
return getApiUrl;
|
||||||
|
});
|
||||||
},
|
},
|
||||||
});
|
});
|
||||||
const { info } = yield r.json();
|
const fn = fileUrlModule.default;
|
||||||
return info.url;
|
return new Promise((resolve) => {
|
||||||
|
return fn(scoreinfo.id, index, resolve);
|
||||||
|
});
|
||||||
});
|
});
|
||||||
|
|
||||||
let pdfBlob;
|
let pdfBlob;
|
||||||
|
|
|
@ -1,6 +1,6 @@
|
||||||
{
|
{
|
||||||
"name": "musescore-downloader",
|
"name": "musescore-downloader",
|
||||||
"version": "0.9.0",
|
"version": "0.9.1",
|
||||||
"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