discogs-marketplace-api-nodejs 1.14.2 → 1.14.3
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
|
@@ -100,14 +100,19 @@ async function scrape({ currencies, genres, formats, formatDescriptions, conditi
|
|
|
100
100
|
throw new Error(detailsResponse.statusText || `An error ${detailsResponse.status} occurred.`);
|
|
101
101
|
}
|
|
102
102
|
const detailsResult = (await detailsResponse.json());
|
|
103
|
-
const details = Object.fromEntries(detailsResult.data?.releases?.map(release =>
|
|
104
|
-
release
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
103
|
+
const details = Object.fromEntries(detailsResult.data?.releases?.map(release => {
|
|
104
|
+
if (!release?.discogsId) {
|
|
105
|
+
return [0, { imageUrl: null, want: 0, have: 0 }];
|
|
106
|
+
}
|
|
107
|
+
return [
|
|
108
|
+
release.discogsId ?? 0,
|
|
109
|
+
{
|
|
110
|
+
imageUrl: release.images?.edges?.[0]?.node?.thumbnail?.webpUrl ?? null,
|
|
111
|
+
want: release.inWantlistCount ?? 0,
|
|
112
|
+
have: release.inCollectionCount ?? 0,
|
|
113
|
+
},
|
|
114
|
+
];
|
|
115
|
+
}) ?? []);
|
|
111
116
|
const items = result.items?.map(item => {
|
|
112
117
|
const detail = details[item.release?.releaseId ?? 0];
|
|
113
118
|
return {
|