通过命令行指定爬取参数,不用再修改代码了
This commit is contained in:
19
index.js
19
index.js
@@ -1,3 +1,20 @@
|
||||
if (process.argv.length <= 2) {
|
||||
let output = [
|
||||
"参数不够",
|
||||
"node index --utils [song|album|artist|lyric|comment] --min [number] --max [number] --order [false|ASC|DESC] --limit [number]",
|
||||
// "",
|
||||
// "node index --utils song --min xxx --max xxx --order ASC --limit 2000",
|
||||
// "node index --utils album --min xxx --max xxx --order ASC --limit 2000",
|
||||
// "node index --utils artist --min xxx --max xxx --order ASC --limit 2000",
|
||||
// "node index --utils lyric --min xxx --max xxx --order ASC --limit 2000",
|
||||
// "node index --utils comment --min xxx --max xxx --order ASC --limit 2000",
|
||||
].join('\n');
|
||||
console.log(output);
|
||||
return;
|
||||
}
|
||||
var args = require('minimist')(process.argv.slice(2));
|
||||
console.log("args:", args);
|
||||
|
||||
global.useMysqlPool = true;
|
||||
const neteaseMusic = require('./netease_music/index');
|
||||
neteaseMusic.main();
|
||||
neteaseMusic.main(args);
|
Reference in New Issue
Block a user