discogs-marketplace-api-nodejs 1.16.2 → 1.16.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.
|
@@ -63,18 +63,14 @@ async function scrape({ currencies, genres, formats, formatDescriptions, conditi
|
|
|
63
63
|
['priceRangeHigh', priceRange?.max.toString() ?? ''],
|
|
64
64
|
].filter(([, p]) => !!p)).toString(),
|
|
65
65
|
].join('?');
|
|
66
|
-
const
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
},
|
|
71
|
-
});
|
|
72
|
-
if (!response.ok()) {
|
|
73
|
-
const message = response.headers()['content-type']?.includes('application/json')
|
|
66
|
+
const browserPage = await browserContext.newPage();
|
|
67
|
+
const response = await browserPage.goto(urlGenerated);
|
|
68
|
+
if (!response?.ok()) {
|
|
69
|
+
const message = response?.headers()['content-type']?.includes('application/json')
|
|
74
70
|
? (await response.json())?.detail
|
|
75
71
|
: '';
|
|
76
72
|
// eslint-disable-next-line @typescript-eslint/prefer-nullish-coalescing
|
|
77
|
-
throw new Error(message || `An error ${response
|
|
73
|
+
throw new Error(message || `An error ${response?.status() ?? '?'} occurred.`);
|
|
78
74
|
}
|
|
79
75
|
const result = (await response.json());
|
|
80
76
|
const detailsResponse = await browserContext.request.post('https://www.discogs.com/graphql', {
|