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 response = await browserContext.request.get(urlGenerated, {
67
- headers: {
68
- 'User-Agent': 'Discogs',
69
- 'Content-Type': 'application/json',
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.status()} occurred.`);
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', {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "discogs-marketplace-api-nodejs",
3
- "version": "1.16.2",
3
+ "version": "1.16.3",
4
4
  "description": "Another (better ?) NodeJs library to fetch data from Discogs marketplace",
5
5
  "keywords": [
6
6
  "discogs",