Skip to content

danbiwer/discogs-marketplace-js

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

73 Commits
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

discogs-marketplace-js

JavaScript library to pull information from the Discogs marketplace. Returns an object.

Usage

Init

var marketplace = require('discogs-marketplace-js');

Search

var search_parameters = {
	id: "Black Sabbath",
	type: "string",
	pagination : {
		page: 1
	}
}

marketplace.search(search_parameters, function(result){
	if(!(result instanceof Error))
		console.log(result);
});

Filters/Pagination

To specify search filters and pagination options, discogs-marketplace-js will accept an object as an input.

var search_parameters = {
	id: "1067610", //id can also be a string, if used with type 'string'
	type: "release", //one of: 'release', 'master', 'label', 'string'
	filters: {
		genre: "Rock",
		style: null,
		format: "Vinyl",
		country: "US",
		decade: null,
		condition: ["Very Good Plus", "Mint"],
		year: 2015,
		currency: "USD",
	},
	pagination: {
		page: 1,
		per_page: 25,
		sort: "Price Lowest Highest"
	}
};

Result

{
	id: '1067610',
	type: 'master',
	pagination: 
	{ 
		items: 1112, 
		hasNext: true
		totalPages : 0 
	},
  	listing: 
   	[ 
   		{	
   			title: 'Black Sabbath - Black Sabbath (8-Trk, Album)',
       		condition_sleeve: 'Very Good (VG)',
	       	condition_media: 'Very Good (VG)',
	       	seller: 'easeup',
	       	ships_from: 'United States',
	       	price: '$45.00' 
	   },
	   { 
	   		title: 'Black Sabbath - Black Sabbath (2xLP, Album, Dlx, RE, RM, 180)',
		    condition_sleeve: 'Near Mint (NM or M-)',
		    condition_media: 'Near Mint (NM or M-)',
		    seller: 'fishtown19125',
		    ships_from: 'United States',
		    price: '$35.00' 
		}
	]
}

Installation

NPM

TODO:

  • Add ability to return a promise when no callback is provided
  • Add rate-limiting features

Releases

No releases published

Packages

No packages published