Repository navigation
Expand file tree
/
Copy pathmain.js
More file actions
59 lines (49 loc) · 1.58 KB
/
Copy pathmain.js
File metadata and controls
59 lines (49 loc) · 1.58 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
import * as R from 'ramda';
import {default as Collector} from './Classes/Collector.js';
import {default as Transformer} from './Classes/Transformer.js';
// Creating all instances
const collector = new Collector();
const transformer = new Transformer();
// Set the WhiteList
// transformer.displayWhiteList();
// transformer.whiteList = ;
// transformer.displayWhiteList();
// Collect and filter appId data
const appIDList = await R.pipeWith(R.andThen, [
collector.getAppIDList,
transformer.filterGameName
])();
// Collect and format gameData
const promiseAll = (x) => Promise.all(x);
const getAndFormatGameData = async (appId) => {
const gameData = await collector.getAppById(appId);
const reviewData = await collector.getReviewById(appId);
const instantPopData = await collector.getInstantPlayersById(appId);
return await R.pipe(
R.assoc('review', reviewData),
R.assoc('instantPop', instantPopData),
transformer.transformGameData
)(gameData);
};
const list = [
{appid: 400, name: 'Portal'},
{appid: 2197370, name: 'Reversed Front'},
{appid: 2197410, name: 'Celestarium'},
{appid: 2197420, name: 'BRoS - Battle Royale of Survival Playtest'}
];
const gameDataList = await R.pipe(
R.map(R.pipe(R.prop('appid'), await getAndFormatGameData)),
promiseAll
)(list);
console.log(
gameDataList.map(
R.pipe(
R.prop('data'),
R.find(R.propEq('salesHistory', 'key')),
R.prop('data')
)
)
);
// transformer.saveAsFile('./Data/appIdList.json', appIDList);
// transformer.saveAsFile('./Data/gameDataList.json', gameDataList);
// console.log(gameDataList);