discogs-marketplace-api-nodejs 1.17.1 → 1.18.1
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.
- package/README.MD +66 -22
- package/dist/interfaces/search-params.interface.d.ts +6 -0
- package/dist/scrapers/browser-context.d.ts +4 -4
- package/dist/scrapers/browser-context.js +9 -14
- package/dist/scrapers/marketplace.scraper.d.ts +1 -1
- package/dist/scrapers/marketplace.scraper.js +26 -5
- package/dist/search.d.ts +4 -3
- package/dist/search.js +4 -3
- package/dist/wantlist.d.ts +3 -3
- package/dist/wantlist.js +4 -3
- package/package.json +13 -13
package/README.MD
CHANGED
|
@@ -1,11 +1,11 @@
|
|
|
1
|
-
#
|
|
1
|
+
# Discogs Marketplace API NodeJS
|
|
2
2
|
|
|
3
3
|
[](https://www.npmjs.com/package/discogs-marketplace-api-nodejs)  [](https://github.com/KirianCaumes/Discogs-Marketplace-API-NodeJS/blob/master/LICENSE) [](https://www.paypal.me/KirianCaumes)
|
|
4
4
|
|
|
5
|
-
A modern TypeScript/Node.js client for scraping and retrieving Discogs Marketplace listings — flexible, type safe, and easy to use.
|
|
6
|
-
>
|
|
5
|
+
A modern TypeScript/Node.js client for scraping and retrieving Discogs Marketplace listings — flexible, type safe, and easy to use.
|
|
6
|
+
> No Discogs API token required — this client scrapes public Marketplace data.
|
|
7
7
|
|
|
8
|
-
##
|
|
8
|
+
## Installation
|
|
9
9
|
|
|
10
10
|
```sh
|
|
11
11
|
npm install discogs-marketplace-api-nodejs
|
|
@@ -15,18 +15,9 @@ npm install discogs-marketplace-api-nodejs
|
|
|
15
15
|
```
|
|
16
16
|
|
|
17
17
|
The searches go through the API of the Discogs shop (`https://www.discogs.com/shop/list`), from a headless browser.
|
|
18
|
+
For many searches, or on a server, see [Browser](#browser).
|
|
18
19
|
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
```ts
|
|
22
|
-
import { chromium } from 'patchright'
|
|
23
|
-
|
|
24
|
-
const browser = await chromium.launch({ headless: true })
|
|
25
|
-
const result = await DiscogsMarketplace.search({ artistIds: [244819] }, browser)
|
|
26
|
-
await browser.close()
|
|
27
|
-
```
|
|
28
|
-
|
|
29
|
-
## ⚡ Quick Start
|
|
20
|
+
## Quick Start
|
|
30
21
|
|
|
31
22
|
```ts
|
|
32
23
|
import { DiscogsMarketplace } from 'discogs-marketplace-api-nodejs'
|
|
@@ -41,7 +32,7 @@ const result = await DiscogsMarketplace.search({
|
|
|
41
32
|
console.log(result.items)
|
|
42
33
|
```
|
|
43
34
|
|
|
44
|
-
##
|
|
35
|
+
## Usage Examples
|
|
45
36
|
|
|
46
37
|
### 1. Get 250 latest listings by a specific artist in the Rock genre, then the next 250
|
|
47
38
|
|
|
@@ -146,9 +137,61 @@ const result = await DiscogsMarketplace.search({
|
|
|
146
137
|
})
|
|
147
138
|
```
|
|
148
139
|
|
|
149
|
-
##
|
|
140
|
+
## Browser
|
|
141
|
+
|
|
142
|
+
By default, each call launches a headless Chromium and closes it. Every search then starts without the clearance of
|
|
143
|
+
Cloudflare (`cf_clearance` cookie), and is blocked more often, especially from a datacenter IP.
|
|
144
|
+
|
|
145
|
+
For many searches, or on a server, pass your own [Patchright](https://github.com/Kaliiiiiiiiii-Vinyzu/patchright)
|
|
146
|
+
browser context as last parameter of `search` and `getWantlistReleaseIds`. It keeps the clearance from one search to
|
|
147
|
+
another, and you manage its lifecycle.
|
|
148
|
+
|
|
149
|
+
```ts
|
|
150
|
+
import { chromium } from 'patchright'
|
|
151
|
+
|
|
152
|
+
const context = await chromium.launchPersistentContext('./profile', {
|
|
153
|
+
channel: 'chrome',
|
|
154
|
+
headless: false,
|
|
155
|
+
viewport: null,
|
|
156
|
+
args: ['--no-sandbox', '--disable-dev-shm-usage'],
|
|
157
|
+
})
|
|
158
|
+
const result = await DiscogsMarketplace.search({ artistIds: [244819] }, context)
|
|
159
|
+
await context.close()
|
|
160
|
+
```
|
|
161
|
+
|
|
162
|
+
- **One context for the whole app**, not one per search, so that every search benefits from the clearance.
|
|
163
|
+
- **Real Chrome, headful** (`channel: 'chrome'`, `headless: false`): it passes Cloudflare far more often. Install it
|
|
164
|
+
with `npx patchright install --with-deps chrome`.
|
|
165
|
+
- **Persistent profile** (`'./profile'`), so the clearance survives restarts. After a crash, delete its `Singleton*`
|
|
166
|
+
files, or Chrome refuses to start.
|
|
167
|
+
- **Without GPU** (server, Docker), add `--disable-gpu --enable-unsafe-swiftshader` to `args`, so Chrome does not hang
|
|
168
|
+
and keeps WebGL.
|
|
169
|
+
- **`env`**: Chrome gets your whole environment, secrets included. Pass only what it needs (`PATH`, `HOME`, `DISPLAY`,
|
|
170
|
+
`XAUTHORITY`...), and its language with `LANG` rather than the `locale` option.
|
|
171
|
+
- **Still blocked?** The IP is the problem: go through a residential proxy (`proxy` option).
|
|
172
|
+
|
|
173
|
+
On a server, headful Chrome needs a display: run your app under Xvfb (`xvfb-run -a node index.js`). With Docker:
|
|
174
|
+
|
|
175
|
+
```dockerfile
|
|
176
|
+
FROM node:24-slim
|
|
177
|
+
|
|
178
|
+
RUN apt-get update \
|
|
179
|
+
&& apt-get install -y --no-install-recommends ca-certificates curl tini xauth xvfb \
|
|
180
|
+
&& rm -rf /var/lib/apt/lists/*
|
|
181
|
+
|
|
182
|
+
WORKDIR /app
|
|
183
|
+
COPY package*.json ./
|
|
184
|
+
RUN npm ci && npx patchright install --with-deps chrome
|
|
185
|
+
COPY . .
|
|
186
|
+
|
|
187
|
+
# -g passes the stop signal to the app, which xvfb-run does not
|
|
188
|
+
ENTRYPOINT ["/usr/bin/tini", "-g", "--", "xvfb-run", "-a"]
|
|
189
|
+
CMD ["node", "index.js"]
|
|
190
|
+
```
|
|
191
|
+
|
|
192
|
+
## API Reference
|
|
150
193
|
|
|
151
|
-
### `DiscogsMarketplace.search(searchParams,
|
|
194
|
+
### `DiscogsMarketplace.search(searchParams, browserContext?)`
|
|
152
195
|
|
|
153
196
|
| Field | Type | Description | Example | Default |
|
|
154
197
|
|-------------------------|-----------------------|------------------------------------------------|-----------------------------------|-----------------|
|
|
@@ -175,6 +218,7 @@ const result = await DiscogsMarketplace.search({
|
|
|
175
218
|
| `hideGenericSleeves` | `boolean` | Hide generic sleeves. | – | `false` |
|
|
176
219
|
| `hideSleevelessMedia` | `boolean` | Hide sleeveless media. | – | `false` |
|
|
177
220
|
| `showUnavailable` | `boolean` | Show unavailable items. | – | `true` |
|
|
221
|
+
| `withCommunityStats` | `boolean` | Get `community` and `release.rating` (slower). | – | `true` |
|
|
178
222
|
| `sort` | `Sort` | Sort and sort order (see below). | `'price,asc'` | `'listed,desc'` |
|
|
179
223
|
| `limit` | `number` | Number of results per page (at most 250). | `100` | `25` |
|
|
180
224
|
| `after` | `string` | Cursor of the page, from `nextCursor`. | – | – |
|
|
@@ -255,19 +299,19 @@ interface SearchResult {
|
|
|
255
299
|
}
|
|
256
300
|
```
|
|
257
301
|
|
|
258
|
-
##
|
|
302
|
+
## Development & Contribution
|
|
259
303
|
|
|
260
304
|
- Clone the repo and use the included devcontainer/VSCode setup.
|
|
261
305
|
- Run: `npm install`
|
|
262
306
|
- Add your contribution.
|
|
263
307
|
- Use `npm test` to run unit tests.
|
|
264
|
-
- Open a pull request with your new additions!
|
|
308
|
+
- Open a pull request with your new additions!
|
|
265
309
|
|
|
266
|
-
##
|
|
310
|
+
## Known Issues
|
|
267
311
|
|
|
268
312
|
- Some search parameters might not be compatible with every type of queries.
|
|
269
313
|
- For other edge cases, feel free to open an [issue on GitHub](https://github.com/KirianCaumes/Discogs-Marketplace-API-NodeJS/issues).
|
|
270
314
|
|
|
271
|
-
##
|
|
315
|
+
## License
|
|
272
316
|
|
|
273
317
|
Licensed under [MIT](https://github.com/KirianCaumes/Discogs-Marketplace-API-NodeJS/blob/master/LICENSE).
|
|
@@ -131,6 +131,12 @@ export interface SearchParams {
|
|
|
131
131
|
* @default true
|
|
132
132
|
*/
|
|
133
133
|
showUnavailable?: boolean;
|
|
134
|
+
/**
|
|
135
|
+
* Get the community stats of the releases (`community` and `release.rating`), at the cost of a second request.
|
|
136
|
+
* If false, `community` is 0 and `release.rating` is null.
|
|
137
|
+
* @default true
|
|
138
|
+
*/
|
|
139
|
+
withCommunityStats?: boolean;
|
|
134
140
|
/**
|
|
135
141
|
* Sort order for the results.
|
|
136
142
|
* @default 'listed,desc'
|
|
@@ -1,10 +1,10 @@
|
|
|
1
|
-
import type {
|
|
1
|
+
import type { BrowserContext } from 'patchright';
|
|
2
2
|
/**
|
|
3
|
-
* Run a function in a
|
|
3
|
+
* Run a function in a browser context suited to call Discogs, closing what it opened afterwards.
|
|
4
4
|
* It looks like a regular Chrome with JavaScript enabled, which Cloudflare lets through more often than the User-Agent
|
|
5
5
|
* of the Discogs apps without JavaScript, especially from datacenter IPs.
|
|
6
|
-
* @param
|
|
6
|
+
* @param browserContext Browser context to use as is, launched and closed here when not provided
|
|
7
7
|
* @param fn Function to run
|
|
8
8
|
* @returns Result of the function
|
|
9
9
|
*/
|
|
10
|
-
export default function withBrowserContext<T>(
|
|
10
|
+
export default function withBrowserContext<T>(browserContext: BrowserContext | undefined, fn: (browserContext: BrowserContext) => Promise<T>): Promise<T>;
|
|
@@ -23,27 +23,22 @@ async function getChromeIdentity(browser) {
|
|
|
23
23
|
}
|
|
24
24
|
}
|
|
25
25
|
/**
|
|
26
|
-
* Run a function in a
|
|
26
|
+
* Run a function in a browser context suited to call Discogs, closing what it opened afterwards.
|
|
27
27
|
* It looks like a regular Chrome with JavaScript enabled, which Cloudflare lets through more often than the User-Agent
|
|
28
28
|
* of the Discogs apps without JavaScript, especially from datacenter IPs.
|
|
29
|
-
* @param
|
|
29
|
+
* @param browserContext Browser context to use as is, launched and closed here when not provided
|
|
30
30
|
* @param fn Function to run
|
|
31
31
|
* @returns Result of the function
|
|
32
32
|
*/
|
|
33
|
-
async function withBrowserContext(
|
|
34
|
-
|
|
33
|
+
async function withBrowserContext(browserContext, fn) {
|
|
34
|
+
if (browserContext) {
|
|
35
|
+
return fn(browserContext);
|
|
36
|
+
}
|
|
37
|
+
const browser = await patchright_1.chromium.launch({ headless: true, chromiumSandbox: false });
|
|
35
38
|
try {
|
|
36
|
-
|
|
37
|
-
try {
|
|
38
|
-
return await fn(browserContext);
|
|
39
|
-
}
|
|
40
|
-
finally {
|
|
41
|
-
await browserContext.close();
|
|
42
|
-
}
|
|
39
|
+
return await fn(await browser.newContext(await getChromeIdentity(browser)));
|
|
43
40
|
}
|
|
44
41
|
finally {
|
|
45
|
-
|
|
46
|
-
await browser.close();
|
|
47
|
-
}
|
|
42
|
+
await browser.close();
|
|
48
43
|
}
|
|
49
44
|
}
|
|
@@ -7,4 +7,4 @@ import type { BrowserContext } from 'patchright';
|
|
|
7
7
|
* @param browserContext Patchright browser context
|
|
8
8
|
* @returns Items found, total, next cursor and url of the same search on Discogs
|
|
9
9
|
*/
|
|
10
|
-
export default function scrapeMarketplace({ query, artistIds, labelIds, masterIds, releaseIds, sellerIds, genres, styles, formats, formatDescriptions, mediaConditions, sleeveConditions, from, currencies, priceRange, sellerRatingMin, sellerRatingCountMin, years, isMakeAnOfferOnly, hasItemPhotos, hideGenericSleeves, hideSleevelessMedia, showUnavailable, sort, limit, after, }: SearchParams, browserContext: BrowserContext): Promise<SearchResult>;
|
|
10
|
+
export default function scrapeMarketplace({ query, artistIds, labelIds, masterIds, releaseIds, sellerIds, genres, styles, formats, formatDescriptions, mediaConditions, sleeveConditions, from, currencies, priceRange, sellerRatingMin, sellerRatingCountMin, years, isMakeAnOfferOnly, hasItemPhotos, hideGenericSleeves, hideSleevelessMedia, showUnavailable, withCommunityStats, sort, limit, after, }: SearchParams, browserContext: BrowserContext): Promise<SearchResult>;
|
|
@@ -49,6 +49,19 @@ const CONDITIONS = {
|
|
|
49
49
|
NOT_GRADED: 'Not Graded',
|
|
50
50
|
NO_COVER: 'No Cover',
|
|
51
51
|
};
|
|
52
|
+
/**
|
|
53
|
+
* Get a new clearance of Cloudflare (`cf_clearance` cookie), the page staying on the Discogs origin
|
|
54
|
+
* @param page Page
|
|
55
|
+
*/
|
|
56
|
+
async function renewClearance(page) {
|
|
57
|
+
const hasClearance = async () => (await page.context().cookies('https://www.discogs.com')).some(x => x.name === 'cf_clearance');
|
|
58
|
+
// Only an HTML page gets it, without one already, sometimes after its load
|
|
59
|
+
await page.context().clearCookies({ name: 'cf_clearance', domain: '.discogs.com' });
|
|
60
|
+
await page.goto('https://www.discogs.com/shop/list', { waitUntil: 'commit' });
|
|
61
|
+
for (let i = 0; i < 100 && !(await hasClearance()); i++) {
|
|
62
|
+
await page.waitForTimeout(100);
|
|
63
|
+
}
|
|
64
|
+
}
|
|
52
65
|
/**
|
|
53
66
|
* Run a GraphQL query of the Discogs shop from the page, which must be on the Discogs origin.
|
|
54
67
|
* @param page Page
|
|
@@ -57,11 +70,12 @@ const CONDITIONS = {
|
|
|
57
70
|
* @returns Response
|
|
58
71
|
*/
|
|
59
72
|
async function queryGraphql(page, operationName, variables) {
|
|
60
|
-
const
|
|
73
|
+
const run = () => page.evaluate(async (body) => {
|
|
61
74
|
const res = await fetch('/graphql', {
|
|
62
75
|
method: 'POST',
|
|
63
76
|
headers: { 'Content-Type': 'application/json' },
|
|
64
77
|
body: JSON.stringify(body),
|
|
78
|
+
signal: AbortSignal.timeout(30_000),
|
|
65
79
|
});
|
|
66
80
|
return {
|
|
67
81
|
status: res.status,
|
|
@@ -70,6 +84,13 @@ async function queryGraphql(page, operationName, variables) {
|
|
|
70
84
|
json: (await res.json().catch(() => null)),
|
|
71
85
|
};
|
|
72
86
|
}, { operationName, variables, extensions: { persistedQuery: { version: 1, sha256Hash: HASHES[operationName] } } });
|
|
87
|
+
let response = await run();
|
|
88
|
+
// Without a clearance of Cloudflare, or a refused one (new IP…)
|
|
89
|
+
if (response.cfMitigated) {
|
|
90
|
+
await renewClearance(page);
|
|
91
|
+
response = await run();
|
|
92
|
+
}
|
|
93
|
+
const { status, cfMitigated, cfRay, json } = response;
|
|
73
94
|
const result = json;
|
|
74
95
|
if (cfMitigated) {
|
|
75
96
|
throw new Error(`An error ${status} occurred: blocked by Cloudflare (${cfMitigated}, cf-ray ${cfRay ?? '?'}).`);
|
|
@@ -119,7 +140,7 @@ function decodeHtmlEntities(text) {
|
|
|
119
140
|
* @param browserContext Patchright browser context
|
|
120
141
|
* @returns Items found, total, next cursor and url of the same search on Discogs
|
|
121
142
|
*/
|
|
122
|
-
async function scrapeMarketplace({ query, artistIds, labelIds, masterIds, releaseIds, sellerIds, genres, styles, formats, formatDescriptions, mediaConditions, sleeveConditions, from, currencies, priceRange, sellerRatingMin, sellerRatingCountMin, years, isMakeAnOfferOnly = false, hasItemPhotos = false, hideGenericSleeves = false, hideSleevelessMedia = false, showUnavailable = true, sort = 'listed,desc', limit = 25, after, }, browserContext) {
|
|
143
|
+
async function scrapeMarketplace({ query, artistIds, labelIds, masterIds, releaseIds, sellerIds, genres, styles, formats, formatDescriptions, mediaConditions, sleeveConditions, from, currencies, priceRange, sellerRatingMin, sellerRatingCountMin, years, isMakeAnOfferOnly = false, hasItemPhotos = false, hideGenericSleeves = false, hideSleevelessMedia = false, showUnavailable = true, withCommunityStats = true, sort = 'listed,desc', limit = 25, after, }, browserContext) {
|
|
123
144
|
const [sortField = 'listed', sortOrder = 'desc'] = sort.split(',');
|
|
124
145
|
const countries = from?.flatMap(code => {
|
|
125
146
|
const names = Object.keys(country_data_1.default).filter(key => code === country_data_1.default[key]);
|
|
@@ -210,10 +231,10 @@ async function scrapeMarketplace({ query, artistIds, labelIds, masterIds, releas
|
|
|
210
231
|
after,
|
|
211
232
|
})).data?.marketplaceSearch;
|
|
212
233
|
const nodes = result?.edges?.map(x => x.node ?? {}) ?? [];
|
|
213
|
-
|
|
234
|
+
// The community stats and the rating of the releases are not part of the listings
|
|
235
|
+
const releaseIdsFound = withCommunityStats ? [...new Set(nodes.map(x => x.release?.discogsId ?? 0).filter(x => !!x))] : [];
|
|
214
236
|
const { data: details } = releaseIdsFound.length
|
|
215
|
-
?
|
|
216
|
-
await queryGraphql(browserPage, 'Releases', { discogsIds: releaseIdsFound, first: 1 })
|
|
237
|
+
? await queryGraphql(browserPage, 'Releases', { discogsIds: releaseIdsFound, first: 1 })
|
|
217
238
|
: { data: undefined };
|
|
218
239
|
const releaseDetails = new Map(details?.releases?.map(x => [x?.discogsId ?? 0, x]) ?? []);
|
|
219
240
|
const items = nodes.map(node => {
|
package/dist/search.d.ts
CHANGED
|
@@ -1,10 +1,11 @@
|
|
|
1
1
|
import type { SearchParams } from './interfaces/search-params.interface.js';
|
|
2
2
|
import type SearchResult from './interfaces/search-result.interface.js';
|
|
3
|
-
import type {
|
|
3
|
+
import type { BrowserContext } from 'patchright';
|
|
4
4
|
/**
|
|
5
5
|
* Performs a search on the Discogs marketplace using the provided parameters.
|
|
6
6
|
* @param searchParams - The search parameters, including query, pagination, and filters.
|
|
7
|
-
* @param
|
|
7
|
+
* @param browserContext - Optional Patchright browser context, which keeps the clearance of Cloudflare from one search to another.
|
|
8
|
+
* If provided, you must manage its lifecycle.
|
|
8
9
|
* @returns A promise that resolves to the search results, including items, total, next cursor and the generated URL.
|
|
9
10
|
*/
|
|
10
|
-
export default function search(searchParams: SearchParams,
|
|
11
|
+
export default function search(searchParams: SearchParams, browserContext?: BrowserContext): Promise<SearchResult>;
|
package/dist/search.js
CHANGED
|
@@ -11,12 +11,13 @@ const MAX_RELEASE_IDS = 2000;
|
|
|
11
11
|
/**
|
|
12
12
|
* Performs a search on the Discogs marketplace using the provided parameters.
|
|
13
13
|
* @param searchParams - The search parameters, including query, pagination, and filters.
|
|
14
|
-
* @param
|
|
14
|
+
* @param browserContext - Optional Patchright browser context, which keeps the clearance of Cloudflare from one search to another.
|
|
15
|
+
* If provided, you must manage its lifecycle.
|
|
15
16
|
* @returns A promise that resolves to the search results, including items, total, next cursor and the generated URL.
|
|
16
17
|
*/
|
|
17
|
-
async function search(searchParams,
|
|
18
|
+
async function search(searchParams, browserContext) {
|
|
18
19
|
if ((searchParams.releaseIds?.length ?? 0) > MAX_RELEASE_IDS) {
|
|
19
20
|
throw new Error(`At most ${MAX_RELEASE_IDS} release IDs are supported.`);
|
|
20
21
|
}
|
|
21
|
-
return (0, browser_context_1.default)(
|
|
22
|
+
return (0, browser_context_1.default)(browserContext, x => (0, marketplace_scraper_1.default)(searchParams, x));
|
|
22
23
|
}
|
package/dist/wantlist.d.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import type {
|
|
1
|
+
import type { BrowserContext } from 'patchright';
|
|
2
2
|
/**
|
|
3
3
|
* Options to get the releases of a wantlist: either from the Discogs API, possibly with a token, or only the ones for sale
|
|
4
4
|
*/
|
|
@@ -22,7 +22,7 @@ export type WantlistOptions = {
|
|
|
22
22
|
* By default, it reads the public Discogs API (limited to 25 requests per minute without token, 60 with).
|
|
23
23
|
* @param username - Username whose wantlist is read.
|
|
24
24
|
* @param options - Options.
|
|
25
|
-
* @param
|
|
25
|
+
* @param browserContext - Optional Patchright browser context, only used with `onlyForSale`. If provided, you must manage its lifecycle.
|
|
26
26
|
* @returns A promise that resolves to the release IDs.
|
|
27
27
|
*/
|
|
28
|
-
export default function getWantlistReleaseIds(username: string, { token, onlyForSale }?: WantlistOptions,
|
|
28
|
+
export default function getWantlistReleaseIds(username: string, { token, onlyForSale }?: WantlistOptions, browserContext?: BrowserContext): Promise<Array<number>>;
|
package/dist/wantlist.js
CHANGED
|
@@ -32,6 +32,7 @@ function fetchWantlist(username, token) {
|
|
|
32
32
|
page: pageNumber.toString(),
|
|
33
33
|
per_page: API_PER_PAGE.toString(),
|
|
34
34
|
}).toString()}`, {
|
|
35
|
+
signal: AbortSignal.timeout(30_000),
|
|
35
36
|
headers: {
|
|
36
37
|
'User-Agent': `DiscogsMarketplaceApiNodeJS-${username}`,
|
|
37
38
|
...(token ? { Authorization: `Discogs token=${token}` } : {}),
|
|
@@ -94,12 +95,12 @@ function scrapeWantlist(username, browserContext) {
|
|
|
94
95
|
* By default, it reads the public Discogs API (limited to 25 requests per minute without token, 60 with).
|
|
95
96
|
* @param username - Username whose wantlist is read.
|
|
96
97
|
* @param options - Options.
|
|
97
|
-
* @param
|
|
98
|
+
* @param browserContext - Optional Patchright browser context, only used with `onlyForSale`. If provided, you must manage its lifecycle.
|
|
98
99
|
* @returns A promise that resolves to the release IDs.
|
|
99
100
|
*/
|
|
100
|
-
async function getWantlistReleaseIds(username, { token, onlyForSale = false } = {},
|
|
101
|
+
async function getWantlistReleaseIds(username, { token, onlyForSale = false } = {}, browserContext) {
|
|
101
102
|
if (onlyForSale) {
|
|
102
|
-
return (0, browser_context_1.default)(
|
|
103
|
+
return (0, browser_context_1.default)(browserContext, x => scrapeWantlist(username, x));
|
|
103
104
|
}
|
|
104
105
|
return fetchWantlist(username, token);
|
|
105
106
|
}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "discogs-marketplace-api-nodejs",
|
|
3
|
-
"version": "1.
|
|
3
|
+
"version": "1.18.1",
|
|
4
4
|
"description": "Another (better ?) NodeJs library to fetch data from Discogs marketplace",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"discogs",
|
|
@@ -40,28 +40,28 @@
|
|
|
40
40
|
}
|
|
41
41
|
],
|
|
42
42
|
"dependencies": {
|
|
43
|
-
"patchright": "^1.
|
|
43
|
+
"patchright": "^1.64.2"
|
|
44
44
|
},
|
|
45
45
|
"devDependencies": {
|
|
46
46
|
"@eslint/js": "^9.39.5",
|
|
47
|
-
"@types/node": "^24.
|
|
48
|
-
"@typescript-eslint/eslint-plugin": "^8.
|
|
49
|
-
"@typescript-eslint/parser": "^8.
|
|
50
|
-
"cspell": "^10.
|
|
47
|
+
"@types/node": "^24.19.2",
|
|
48
|
+
"@typescript-eslint/eslint-plugin": "^8.72.1",
|
|
49
|
+
"@typescript-eslint/parser": "^8.72.1",
|
|
50
|
+
"cspell": "^10.4.0",
|
|
51
51
|
"eslint": "^9.39.5",
|
|
52
52
|
"eslint-config-prettier": "^10.1.8",
|
|
53
53
|
"eslint-import-resolver-typescript": "^4.4.5",
|
|
54
54
|
"eslint-plugin-import": "^2.32.0",
|
|
55
|
-
"eslint-plugin-jsdoc": "^
|
|
56
|
-
"globals": "^17.
|
|
55
|
+
"eslint-plugin-jsdoc": "^65.4.2",
|
|
56
|
+
"globals": "^17.13.0",
|
|
57
57
|
"husky": "^9.1.7",
|
|
58
|
-
"knip": "^6.
|
|
59
|
-
"lint-staged": "^17.
|
|
60
|
-
"prettier": "^3.9.
|
|
58
|
+
"knip": "^6.43.0",
|
|
59
|
+
"lint-staged": "^17.6.0",
|
|
60
|
+
"prettier": "^3.9.10",
|
|
61
61
|
"rimraf": "^6.1.3",
|
|
62
|
-
"tsc-alias": "^1.9.
|
|
62
|
+
"tsc-alias": "^1.9.9",
|
|
63
63
|
"tsx": "^4.23.15",
|
|
64
64
|
"typescript": "^6.0.3",
|
|
65
|
-
"typescript-eslint": "^8.
|
|
65
|
+
"typescript-eslint": "^8.72.1"
|
|
66
66
|
}
|
|
67
67
|
}
|