-
Notifications
You must be signed in to change notification settings - Fork 15
v2.beatmaps.download_v3
ck edited this page Oct 6, 2024
·
2 revisions
const { auth, v2 } = require('osu-api-extended');
async function main() {
try {
// only for downloading sets from osu host
await auth.login({
type: 'lazer',
login: login,
password: password,
cachedTokenPath: './test.json' // path to the file your auth token will be saved (to prevent osu!api spam)
});
const progress_update = (...args) => {
console.log(args);
};
const set_id = 320118;
const result = await v2.beatmaps.download({
type: 'set',
host: 'gatari',
id: set_id,
file_path: `./cache/${set_id}.osz`,
progress_log_fn: progress_update
});
if (result.error != null) {
console.log(result.error);
return;
};
console.log(result);
} catch (error) {
console.log(error);
};
};
main();
Parameter | Type | Description |
---|---|---|
params.type | 'difficulty' or 'set' | |
params.id | number | |
params.host | string | |
params.file_path | string | |
params.overwrite | boolean | |
params.progress_log_fn | (host: string, progress: number) => void | |
params.no_video | boolean | |
addons.legacy_only? | boolean | |
addons.apiVersion? | '20240130' | '99999999' |
addons.authKey? | string | |
addons.timeout_ms? | number | |
addons.ignoreSessionRefresh? | boolean |
Parameter | Type | Description |
---|---|---|
progress | number |
import { IError } from "..";
export type BeatmapsDownloadResponse = {
status: string,
destination?: string,
/**
* Time in milliseconds
*/
elapsed_time?: number
} & IError;