mkmrare/fetch.ts

17 lines
394 B
TypeScript
Raw Normal View History

2019-11-21 14:16:04 +00:00
import CardMarketApi from "./api";
2019-11-21 15:56:34 +00:00
import { asyncSaveJSON } from "./utils";
2019-11-21 14:16:04 +00:00
async function run() {
if (process.argv.length < 3) {
console.error("Usage: yarn fetch <uid>");
process.exit(1);
return;
}
const uid = process.argv[2];
let api = new CardMarketApi();
2019-11-21 15:56:34 +00:00
const articles = await api.getAllArticles(uid);
2019-11-21 14:16:04 +00:00
await asyncSaveJSON(`${uid}-cards.json`, articles);
}
run();