2022-10-17 13:11:15 +08:00
|
|
|
if (process.argv.length <= 2) {
|
|
|
|
let output = [
|
|
|
|
"参数不够",
|
2022-10-31 15:54:48 +08:00
|
|
|
"node index --utils [song|album|artist|lyric|comment|playlist|assistant] --min [number] --max [number] --order [false|ASC|DESC] --limit [number]",
|
2022-10-17 13:11:15 +08:00
|
|
|
// "",
|
2022-10-25 19:36:05 +08:00
|
|
|
// "node index --utils xxx --min xxx --max xxx --order ASC --limit 2000",
|
2022-10-02 23:48:07 +08:00
|
|
|
].join('\n');
|
2022-10-17 13:11:15 +08:00
|
|
|
console.log(output);
|
|
|
|
return;
|
2022-10-01 22:00:29 +08:00
|
|
|
}
|
2022-10-17 13:11:15 +08:00
|
|
|
var args = require('minimist')(process.argv.slice(2));
|
2022-10-25 19:36:05 +08:00
|
|
|
args = {
|
|
|
|
// 子模块
|
|
|
|
utils: args.utils,
|
|
|
|
// id 范围
|
|
|
|
min: Number(args.min) || undefined,
|
|
|
|
max: Number(args.max) || undefined,
|
|
|
|
// 顺序
|
|
|
|
order: args.order,
|
|
|
|
// 数量
|
|
|
|
limit: Number(args.limit) || undefined,
|
|
|
|
// 分区
|
|
|
|
partition: Number(args.partition) || undefined,
|
2022-10-29 00:16:36 +08:00
|
|
|
// #################################
|
|
|
|
// 两次请求之间等待时间
|
2022-10-25 19:36:05 +08:00
|
|
|
sleepTime: Number(args.sleepTime) || 100,
|
2022-10-29 00:16:36 +08:00
|
|
|
// 数据库
|
|
|
|
database: args.database || "neteasemusic",
|
2022-10-25 19:36:05 +08:00
|
|
|
}
|
|
|
|
|
2022-10-17 13:11:15 +08:00
|
|
|
console.log("args:", args);
|
2022-10-01 22:00:29 +08:00
|
|
|
|
2022-10-29 00:16:36 +08:00
|
|
|
// 指定数据库名
|
|
|
|
if (args.database != "neteasemusic")
|
|
|
|
console.log(`注意,当前连接的数据库 [${args.database}] 非业务数据库`);
|
|
|
|
global.database = args.database;
|
|
|
|
|
2022-10-25 19:36:05 +08:00
|
|
|
global.sleepTime = args.sleepTime; // 两次请求之间停顿时间
|
2022-10-17 13:11:15 +08:00
|
|
|
global.useMysqlPool = true;
|
|
|
|
const neteaseMusic = require('./src/index');
|
|
|
|
neteaseMusic.main(args);
|