Skip to content

Commit be5f97b

Browse files
committed
Game data
1 parent d463786 commit be5f97b

File tree

253 files changed

+20893
-38
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

253 files changed

+20893
-38
lines changed

.eslintrc.js

+4-1
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,9 @@ module.exports = {
2222
'react',
2323
],
2424
rules: {
25-
"arrow-body-style": "off"
25+
"arrow-body-style": "off",
26+
"jsx-a11y/anchor-is-valid": "off",
27+
"react/no-unescaped-entities": "off",
28+
"react/prop-types": "off",
2629
},
2730
};

apps-data.json

+6,898
Large diffs are not rendered by default.

apps-final.json

+1,027
Large diffs are not rendered by default.

apps.json

+1,027
Large diffs are not rendered by default.

build/webpack.config.js

+14-21
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,6 @@ const env = process.env.NODE_ENV || 'development';
1717
const target = process.env.TARGET || 'web';
1818

1919

20-
2120
module.exports = {
2221
mode: env,
2322
entry: {
@@ -74,15 +73,14 @@ module.exports = {
7473
},
7574

7675

77-
7876
{
7977
test: /\.css$/,
8078
use: [
8179
(env === 'development' ? 'style-loader' : {
8280
loader: MiniCssExtractPlugin.loader,
8381
options: {
84-
publicPath: '../'
85-
}
82+
publicPath: '../',
83+
},
8684
}),
8785
'css-loader',
8886
'postcss-loader',
@@ -94,8 +92,8 @@ module.exports = {
9492
(env === 'development' ? 'style-loader' : {
9593
loader: MiniCssExtractPlugin.loader,
9694
options: {
97-
publicPath: '../'
98-
}
95+
publicPath: '../',
96+
},
9997
}),
10098
'css-loader',
10199
'postcss-loader',
@@ -108,8 +106,8 @@ module.exports = {
108106
(env === 'development' ? 'style-loader' : {
109107
loader: MiniCssExtractPlugin.loader,
110108
options: {
111-
publicPath: '../'
112-
}
109+
publicPath: '../',
110+
},
113111
}),
114112
'css-loader',
115113
'postcss-loader',
@@ -122,8 +120,8 @@ module.exports = {
122120
(env === 'development' ? 'style-loader' : {
123121
loader: MiniCssExtractPlugin.loader,
124122
options: {
125-
publicPath: '../'
126-
}
123+
publicPath: '../',
124+
},
127125
}),
128126
'css-loader',
129127
'postcss-loader',
@@ -132,29 +130,24 @@ module.exports = {
132130
},
133131
{
134132
test: /\.(png|jpe?g|gif|svg)(\?.*)?$/,
135-
loader: 'url-loader',
133+
loader: 'file-loader',
136134
options: {
137-
limit: 10000,
138135
name: 'images/[name].[ext]',
139-
136+
esModule: false,
140137
},
141138
},
142139
{
143140
test: /\.(mp4|webm|ogg|mp3|wav|flac|aac|m4a)(\?.*)?$/,
144-
loader: 'url-loader',
141+
loader: 'file-loader',
145142
options: {
146-
limit: 10000,
147143
name: 'media/[name].[ext]',
148-
149144
},
150145
},
151146
{
152147
test: /\.(woff2?|eot|ttf|otf)(\?.*)?$/,
153-
loader: 'url-loader',
148+
loader: 'file-loader',
154149
options: {
155-
limit: 10000,
156150
name: 'fonts/[name].[ext]',
157-
158151
},
159152
},
160153
],
@@ -188,7 +181,7 @@ module.exports = {
188181
removeRedundantAttributes: true,
189182
removeScriptTypeAttributes: true,
190183
removeStyleLinkTypeAttributes: true,
191-
useShortDoctype: true
184+
useShortDoctype: true,
192185
} : false,
193186
}),
194187
new MiniCssExtractPlugin({
@@ -209,4 +202,4 @@ module.exports = {
209202
swSrc: resolvePath('src/service-worker.js'),
210203
}),
211204
],
212-
};
205+
};

convert-apps.js

+44
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,44 @@
1+
const fs = require('fs');
2+
const apps = require('./apps-data');
3+
4+
const newApps = apps.map((app) => {
5+
const {
6+
versions,
7+
icon,
8+
title,
9+
slug,
10+
description,
11+
price,
12+
screenshots,
13+
release_date,
14+
size,
15+
subtitle,
16+
promotionalText,
17+
rating,
18+
id,
19+
developer,
20+
} = app.content;
21+
22+
const screens = (screenshots.iphone_6_5.length ? screenshots.iphone_6_5 : screenshots.iphone_5_8).map((screen, index) => {
23+
return `${slug}-${index + 1}.${screen.url.slice(-3)}`;
24+
});
25+
return {
26+
id,
27+
title,
28+
slug,
29+
subtitle,
30+
icon: `${slug}-icon.${icon.slice(-3)}`,
31+
description,
32+
price,
33+
release_date,
34+
size,
35+
promotionalText,
36+
rating: rating.average,
37+
developer,
38+
screenshots: screens,
39+
versions,
40+
}
41+
});
42+
43+
fs.writeFileSync('./apps-final.json', JSON.stringify(newApps, '', 2));
44+

convert-games.js

+44
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,44 @@
1+
const fs = require('fs');
2+
const apps = require('./games-data');
3+
4+
const newApps = apps.map((app) => {
5+
const {
6+
versions,
7+
icon,
8+
title,
9+
slug,
10+
description,
11+
price,
12+
screenshots,
13+
release_date,
14+
size,
15+
subtitle,
16+
promotionalText,
17+
rating,
18+
id,
19+
developer,
20+
} = app.content;
21+
22+
const screens = (screenshots.iphone_6_5.length ? screenshots.iphone_6_5 : screenshots.iphone_5_8).map((screen, index) => {
23+
return `${slug}-${index + 1}.${screen.url.slice(-3)}`;
24+
});
25+
return {
26+
id,
27+
title,
28+
slug,
29+
subtitle,
30+
icon: `${slug}-icon.${icon.slice(-3)}`,
31+
description,
32+
price,
33+
release_date,
34+
size,
35+
promotionalText,
36+
rating: rating.average,
37+
developer,
38+
screenshots: screens,
39+
versions,
40+
}
41+
});
42+
43+
fs.writeFileSync('./games-final.json', JSON.stringify(newApps, '', 2));
44+

download-images.js

+29
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,29 @@
1+
/* eslint-disable */
2+
const fs = require('fs');
3+
const request = require('request');
4+
5+
function download(uri, filename, callback) {
6+
request.head(uri, (err, res, body) => {
7+
console.log('content-type:', res.headers['content-type']);
8+
console.log('content-length:', res.headers['content-length']);
9+
10+
request(uri).pipe(fs.createWriteStream(`./games-images/${filename}`)).on('close', callback);
11+
});
12+
}
13+
14+
const apps = require('./games');
15+
16+
const toDownload = {};
17+
apps.forEach((app) => {
18+
const iconExt = app.icon.slice(-3);
19+
toDownload[app.icon] = `${app.slug}-icon.${iconExt}`;
20+
app.screenshots.forEach((screenUrl, index) => {
21+
const ext = screenUrl.slice(-3);
22+
toDownload[screenUrl] = `${app.slug}-${index + 1}.${ext}`;
23+
});
24+
});
25+
26+
Object.keys(toDownload).forEach((url) => {
27+
const fileName = toDownload[url];
28+
download(url, fileName, () => {});
29+
});

fetch-apps.js

+25
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,25 @@
1+
const path = require('path');
2+
const fs = require('fs');
3+
const axios = require('axios');
4+
5+
const instance = axios.create({
6+
headers: { 'X-Apptweak-Key': 'u_zbcrCnNQSwyCSKq28xZ3oby5A' },
7+
});
8+
9+
async function request() {
10+
const appsResponse = await instance.get('https://api.apptweak.com/ios/categories/0/top.json?country=us&language=en&device=iphone&num=20');
11+
const appsData = appsResponse.data;
12+
13+
const toFetch = appsData.content.slice(0, 20);
14+
15+
const requests = toFetch.map((appData) => {
16+
return instance.get(`https://api.apptweak.com/ios/applications/${appData.id}/metadata.json?country=us&language=en&device=iphone&max-age=86400`);
17+
});
18+
19+
Promise.all(requests).then((items) => {
20+
const data = items.map((item) => item.data);
21+
fs.writeFileSync('apps-data.json', JSON.stringify(data, '', 2));
22+
});
23+
}
24+
25+
request();

fetch-games.js

+25
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,25 @@
1+
const path = require('path');
2+
const fs = require('fs');
3+
const axios = require('axios');
4+
5+
const instance = axios.create({
6+
headers: { 'X-Apptweak-Key': 'u_zbcrCnNQSwyCSKq28xZ3oby5A' },
7+
});
8+
9+
async function request() {
10+
const appsResponse = await instance.get('https://api.apptweak.com/ios/categories/6014/top.json?country=us&language=en&device=iphone&num=20');
11+
const appsData = appsResponse.data;
12+
13+
const toFetch = appsData.content.slice(0, 20);
14+
15+
const requests = toFetch.map((appData) => {
16+
return instance.get(`https://api.apptweak.com/ios/applications/${appData.id}/metadata.json?country=us&language=en&device=iphone&max-age=86400`);
17+
});
18+
19+
Promise.all(requests).then((items) => {
20+
const data = items.map((item) => item.data);
21+
fs.writeFileSync('games-data.json', JSON.stringify(data, '', 2));
22+
});
23+
}
24+
25+
request();

0 commit comments

Comments
 (0)