-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathtest.js
More file actions
23 lines (21 loc) · 918 Bytes
/
test.js
File metadata and controls
23 lines (21 loc) · 918 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
const path = require('path');
const G2A = require('./app/models/G2A');
const InstantGaming = require('./app/models/InstantGaming');
require('dotenv').config();
(async () => {
const store = new G2A();
//const store = new InstantGaming();
const instanceName = 'InstantGaming';
await store.openBrowser();
await store.getLinks(4);
console.log(`links: ${store.links.length}`);
await store.getProducts();
console.log(`products: ${store.products.length}`)
const productString = JSON.stringify(store.products[0], null, 2);
console.log(`Example product: ${productString}`);
await store.closeBrowser();
const linksFile = path.join(__dirname, 'app', 'data', `${instanceName}_links.json`);
const productsFile = path.join(__dirname, 'app', 'data', `${instanceName}_products.json`)
store.writeToFile(linksFile, store.links, 'links');
store.writeToFile(productsFile, store.products, 'products');
})();