Skip to content

Commit 376d823

Browse files
authored
fix: Missing version, updated timestamp and recent changes (#726)
1 parent 1bad7ba commit 376d823

2 files changed

Lines changed: 19 additions & 4 deletions

File tree

lib/app.js

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -92,14 +92,17 @@ const MAPPINGS = {
9292
IAPRange: ['ds:5', 1, 2, 19, 0],
9393
androidVersion: {
9494
path: ['ds:5', 1, 2, 140, 1, 1, 0, 0, 1],
95+
fallbackPath: ['ds:5', 1, 2, -1, '141', 1, 1, 0, 0, 1],
9596
fun: helper.normalizeAndroidVersion
9697
},
9798
androidVersionText: {
9899
path: ['ds:5', 1, 2, 140, 1, 1, 0, 0, 1],
100+
fallbackPath: ['ds:5', 1, 2, -1, '141', 1, 1, 0, 0, 1],
99101
fun: (version) => version || 'Varies with device'
100102
},
101103
androidMaxVersion: {
102104
path: ['ds:5', 1, 2, 140, 1, 1, 0, 1, 1],
105+
fallbackPath: ['ds:5', 1, 2, -1, '141', 1, 1, 0, 1, 1],
103106
fun: helper.normalizeAndroidVersion
104107
},
105108
developer: ['ds:5', 1, 2, 68, 0],
@@ -161,13 +164,19 @@ const MAPPINGS = {
161164
released: ['ds:5', 1, 2, 10, 0],
162165
updated: {
163166
path: ['ds:5', 1, 2, 145, 0, 1, 0],
167+
fallbackPath: ['ds:5', 1, 2, -1, '146', 0, 1, 0],
164168
fun: (ts) => ts * 1000
165169
},
166170
version: {
167171
path: ['ds:5', 1, 2, 140, 0, 0, 0],
172+
fallbackPath: ['ds:5', 1, 2, -1, '141', 0, 0, 0],
168173
fun: (val) => val || 'VARY'
169174
},
170-
recentChanges: ['ds:5', 1, 2, 144, 1, 1],
175+
recentChanges: {
176+
path: ['ds:5', 1, 2, 144, 1, 1],
177+
fallbackPath: ['ds:5', 1, 2, -1, '145', 1, 1],
178+
fun: (val) => val
179+
},
171180
comments: {
172181
path: [],
173182
isArray: true,

lib/utils/scriptData.js

Lines changed: 9 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -45,9 +45,15 @@ function extractor (mappings) {
4545
// extractDataWithServiceRequestId explanation:
4646
// https://github.com/facundoolano/google-play-scraper/pull/412
4747
// assume spec object
48-
const input = (spec.useServiceRequestId)
49-
? extractDataWithServiceRequestId(parsedData, spec)
50-
: R.path(spec.path, parsedData);
48+
let input;
49+
if (spec.useServiceRequestId) {
50+
input = extractDataWithServiceRequestId(parsedData, spec);
51+
} else {
52+
input = R.path(spec.path, parsedData);
53+
if ((input === null || input === undefined) && spec.fallbackPath) {
54+
input = R.path(spec.fallbackPath, parsedData);
55+
}
56+
}
5157

5258
return spec.fun(input, parsedData);
5359
}, mappings);

0 commit comments

Comments
 (0)