1
0
Code Issues Pull Requests Projects Releases Wiki Activity GitHub Gitee
tools/netease_music/index.js

41 lines
1.3 KiB
JavaScript

if (process.argv.length <= 2) {
let output = [
"参数不够",
"node index --utils [song|album|artist|lyric|comment|playlist|assistant] --min [number] --max [number] --order [false|ASC|DESC] --limit [number]",
// "",
// "node index --utils xxx --min xxx --max xxx --order ASC --limit 2000",
].join('\n');
console.log(output);
return;
}
var args = require('minimist')(process.argv.slice(2));
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,
// #################################
// 两次请求之间等待时间
sleepTime: Number(args.sleepTime) || 100,
// 数据库
database: args.database || "neteasemusic",
}
console.log("args:", args);
// 指定数据库名
if (args.database != "neteasemusic")
console.log(`注意,当前连接的数据库 [${args.database}] 非业务数据库`);
global.database = args.database;
global.sleepTime = args.sleepTime; // 两次请求之间停顿时间
global.useMysqlPool = true;
const neteaseMusic = require('./src/index');
neteaseMusic.main(args);