Another (better ?) NodeJs library to fetch data from Discogs marketplace
npm install discogs-marketplace-api-nodejs !GitHub Repo stars  
A modern TypeScript/Node.js client for scraping and retrieving Discogs Marketplace listings β flexible, type safe, and easy to use. πΏ
> πͺ No Discogs API token required β this client scrapes public Marketplace data.
``sh
npm install discogs-marketplace-api-nodejs
β‘ Quick Start
`ts
import { DiscogsMarketplace } from 'discogs-marketplace-api-nodejs'const result = await DiscogsMarketplace.search({
api: 'v2',
artistIds: [244819],
genres: ['Rock'],
sort: 'price,asc',
limit: 50,
page: 1,
})
console.log(result.items)
`π Usage Examples
This library offers two API modes to access Discogs Marketplace data. The required
api parameter determines which endpoint to use:-
api: 'v2' (Modern JSON API) - Recommended for most use cases, offers advanced filtering
- api: 'legacy' (HTML scraping) - Required for certain search types and general queriesEach API has different capabilities and available parameters. See the API Reference section for complete details.
$3
`ts
// https://www.discogs.com/sell/list?sort=listed,desc&limit=250&artist_id=244819&page=2&genre=Rock
const result = await DiscogsMarketplace.search({
api: 'legacy',
artistId: 244819,
genre: 'Rock',
sort: 'listed,desc',
limit: 250,
page: 2,
})
// OR
const result = await DiscogsMarketplace.search({
api: 'v2',
artistIds: [244819],
genres: ['Rock'],
sort: 'listed,desc',
limit: 250,
page: 2,
})
`$3
`ts
// https://www.discogs.com/shop/mywants
const result = await DiscogsMarketplace.search({
api: 'v2',
limit: 50,
sort: 'price,asc',
wantlist: 'Kirian_',
})
`$3
`ts
// https://www.discogs.com/sell/list?release_id=767931&sort=seller,asc&limit=25
// https://www.discogs.com/sell/release/767931?sort=seller,asc&limit=25
const result = await DiscogsMarketplace.search({
api: 'legacy',
releaseId: 767931,
sort: 'seller,asc',
})
// OR
const result = await DiscogsMarketplace.search({
api: 'v2',
releaseIds: [767931],
sort: 'seller,asc',
})
`$3
`ts
// https://www.discogs.com/sell/list?sort=listed,desc&limit=100&q=in+flames&page=1
const result = await DiscogsMarketplace.search({
api: 'legacy',
query: 'in flames',
sort: 'listed,desc',
limit: 100,
})
`$3
`ts
// https://www.discogs.com/sell/list?sort=listed,desc&seller=Kirian_
// https://www.discogs.com/seller/Kirian_/profile?sort=listed,desc
const result = await DiscogsMarketplace.search({
api: 'legacy',
sort: 'listed,desc',
seller: 'Kirian_',
})
// OR
const result = await DiscogsMarketplace.search({
api: 'v2',
sort: 'listed,desc',
sellerIds: [6562907],
})
`$3
`ts
// https://www.discogs.com/seller/Kirian_/mywants?sort=listed,desc&user=Kirian_
const result = await DiscogsMarketplace.search({
api: 'legacy',
sort: 'listed,desc',
seller: 'Kirian_',
user: 'Kirian_',
})
// OR
const result = await DiscogsMarketplace.search({
api: 'v2',
sort: 'listed,desc',
wantlist: 'Kirian_',
sellerIds: [6562907],
})
`$3
`ts
// https://www.discogs.com/sell/list?master_id=28291&q=red
const result = await DiscogsMarketplace.search({
api: 'legacy',
sort: 'listed,desc',
masterId: 2167270,
query: 'red',
})
`π§© API Reference
This library provides two different ways to search the Discogs Marketplace:
- Modern API (
api: 'v2') β JSON API, used by the Discogs "My Wants" page.
- Legacy API (api: 'legacy') β HTML scraping, required for some cases.Both share common search filters and extend them with API-specific options via the
SearchParams interface.$3
| Field | Type | Description | Example | Default |
|-------------------------|---------------------|------------------------------------|-------------------------|---------|
|
api | 'v2' | Selects the modern API. | 'v2' | β |
| currencies | Currency[] | Filter by multiple currencies. | ['USD', 'EUR'] | β |
| conditions | Condition[] | List of media/sleeve conditions. | ['Mint (M)'] | β |
| genres | Genre[] | Filter by multiple genres. | ['Rock', 'Jazz'] | β |
| from | From[] | Filter by sellerβs countries. | ['FR', 'DE'] | β |
| sort | Sort | Sort and sort order. | 'listed,desc' | 'listed,desc' |
| limit | number | Number of results per page. | 100 | 25 |
| artistIds | number[] | Filter by artist IDs. | [123, 456] | β |
| sellerIds | number[] | Filter by seller IDs. | [789, 1011] | β |
| priceRange.min/max | number | Filter by price range. | { min: 10, max: 100 } | β |
| sellerRatingMin | number (0β100) | Minimum seller rating. | 90 | 0 |
| hideGenericSleeves | boolean | Hide generic sleeves. | β | false |
| hideSleevelessMedia | boolean | Hide sleeveless media. | β | false |
| showUnavailable | boolean | Show unavailable items. | β | true |
| sellerRatingCountMin | number | Minimum number of seller ratings. | 50 | 0 |
| wantlist* | string | Search by wantlist username. | "username" | β |
| releaseIds* | number[] | Search by release IDs. | [12345, 67890] | β |\* Only one of
wantlist or releaseIds can be used.$3
| Field | Type | Description | Example | Default |
|--------------|-----------------|------------------------------------|--------------------------------|---------|
|
api | 'legacy' | Selects the legacy API. | 'legacy' | β |
| query | string | Search string. | "something" | β |
| currency | Currency | Currency code for price filtering. | 'USD' | β |
| condition | Condition | Media/sleeve conditions. | 'Mint (M)' | β |
| genre | Genre | Filter by genre. | 'Rock' | β |
| styles | Style[] | Filter by style. | ['Death Metal', 'Heavy Metal'] | β |
| from | From | Filter by sellerβs country. | 'FR' | β |
| sort | Sort | Sort order for results. | 'listed,desc' | 'listed,desc' |
| limit | 25 \| 50 \| 100 \| 250 | Number of results per page. | 100 | 25 |
| seller | string | Filter by seller username. | "seller_name" | β |
| user | string | Filter by user. | "my_username" | β |
| lang | Lang | Discogs interface language. | 'en' | 'en' |
| masterId* | number | Search by master release ID. | 12345 | β |
| labelId* | number | Search by label ID. | 67890 | β |
| releaseId* | number | Search by release ID. | 11111 | β |
| artistId* | number | Search by artist ID. | 22222 | β |\* Only one of
masterId, labelId, releaseId, or artistId can be used.$3
| Field | Type | Description | Example | Default |
|-----------------------|------------------------------|------------------------------------------------|----------------------------------------|---------|
|
formats | Format[] | List of formats. | ['Vinyl', 'CD'] | β |
| formatDescriptions | FormatDescription[] | List of format descriptions. | ['Limited Edition', 'Numbered'] | β |
| years.min / max | number | Year range. | { min: 1980, max: 1990 } | β |
| isMakeAnOfferOnly | boolean | Only return listings that accept offers. | β | false |
| page | number | Page number (must be < 401 to avoid 404). | 2 | 1 |On success, a
SearchResult interface is returned:`ts
interface SearchResult {
items: Array<{
id: number
title: string
artists: Array<{
id: number | null
name: string
url: string | null
}>
release: {
id: number
name: string
url: string
}
formats: Array
labels: Array<{
id: number
name: string
url: string
}>
url: string
listedAt: Date | null
catnos: Array
imageUrl: string | null
description: string | null
isAcceptingOffer: boolean
isAvailable: boolean
condition: {
media: {
full: string
short: string
}
sleeve: {
full: string | null
short: string | null
}
}
seller: {
name: string
url: string
score: string | null
notes: number | null
}
price: {
/* @example '12.34 USD' /
base: ${number} ${CurrencyValues}
/* @example '5.67 USD' /
shipping: ${number} ${CurrencyValues} | null
}
country: {
name: string
/* @example 'US' /
code: CountryValues
}
community: {
have: number
want: number
}
}>
page: {
current: number
total: number
}
result: {
total: number
perPage: number
}
urlGenerated: string
}
`π οΈ Development & Contribution
- Clone the repo and use the included devcontainer/VSCode setup.
- Run:
npm install
- Add your contribution.
- Use npm test` to run unit tests.- Requests hitting page >400 will result in a 404 on the legacy API.
- Some search parameters might not be compatible with every type of queries.
- For other edge cases, feel free to open an issue on GitHub.
Licensed under MIT.