discogs-marketplace-api-nodejs 1.3.4 → 1.3.7

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 CHANGED
@@ -201,3 +201,43 @@ interface IOutputError {
201
201
  code: number
202
202
  }
203
203
  ```
204
+
205
+ ## How to contribute
206
+
207
+ There is a devcontainer on that project already configured, feel free to use it.
208
+
209
+ You can install dependecies with:
210
+
211
+ ```sh
212
+ npm i
213
+ ```
214
+
215
+ And then create a new file that import `DiscogsMarketplace` and run query to try your updates.
216
+
217
+ Finally, you can open a pull request with your new additions.
218
+
219
+ ## Know issues
220
+
221
+ ### Playwright
222
+
223
+ Try this if chrome wasn't installed with `npm i`:
224
+
225
+ ```sh
226
+ npx playwright install
227
+ ```
228
+
229
+ ### Linkedom
230
+
231
+ If you are using this librairy on a Typescript project, you might encounter issues with `linkedom`.
232
+
233
+ To fix it, use this in command line: `--skipLibCheck` or add that in you `tsconfig.json`:
234
+
235
+ ```json
236
+ {
237
+ "compilerOptions": {
238
+ "skipLibCheck": true
239
+ }
240
+ }
241
+ ```
242
+
243
+ If you found another problem, feel free to open an issue.
@@ -3,18 +3,28 @@
3
3
  */
4
4
  declare enum EDiscogsCurrencyToIsoCode {
5
5
  $US = "USD",
6
+ US$ = "USD",
7
+ USD = "USD",
6
8
  '£GB' = "GBP",
9
+ GBP = "GBP",
7
10
  $CA = "CAD",
11
+ CA$ = "CAD",
12
+ CAD = "CAD",
8
13
  $AU = "AUD",
14
+ AU$ = "AUD",
15
+ AUD = "AUD",
9
16
  JPY = "JPY",
10
17
  CHF = "CHF",
11
18
  MX$ = "MXN",
19
+ MXN = "MXN",
12
20
  $NZ = "NZD",
21
+ NZD = "NZD",
13
22
  SEK = "SEK",
14
23
  ZAR = "ZAR",
15
- CA$ = "CAD",
24
+ BRL = "BRL",
16
25
  A$ = "AUD",
17
26
  R$ = "BRL",
27
+ EUR = "EUR",
18
28
  '€' = "EUR",
19
29
  $ = "USD",
20
30
  '£' = "GBP",
@@ -6,18 +6,28 @@ Object.defineProperty(exports, "__esModule", { value: true });
6
6
  var EDiscogsCurrencyToIsoCode;
7
7
  (function (EDiscogsCurrencyToIsoCode) {
8
8
  EDiscogsCurrencyToIsoCode["$US"] = "USD";
9
+ EDiscogsCurrencyToIsoCode["US$"] = "USD";
10
+ EDiscogsCurrencyToIsoCode["USD"] = "USD";
9
11
  EDiscogsCurrencyToIsoCode["\u00A3GB"] = "GBP";
12
+ EDiscogsCurrencyToIsoCode["GBP"] = "GBP";
10
13
  EDiscogsCurrencyToIsoCode["$CA"] = "CAD";
14
+ EDiscogsCurrencyToIsoCode["CA$"] = "CAD";
15
+ EDiscogsCurrencyToIsoCode["CAD"] = "CAD";
11
16
  EDiscogsCurrencyToIsoCode["$AU"] = "AUD";
17
+ EDiscogsCurrencyToIsoCode["AU$"] = "AUD";
18
+ EDiscogsCurrencyToIsoCode["AUD"] = "AUD";
12
19
  EDiscogsCurrencyToIsoCode["JPY"] = "JPY";
13
20
  EDiscogsCurrencyToIsoCode["CHF"] = "CHF";
14
21
  EDiscogsCurrencyToIsoCode["MX$"] = "MXN";
22
+ EDiscogsCurrencyToIsoCode["MXN"] = "MXN";
15
23
  EDiscogsCurrencyToIsoCode["$NZ"] = "NZD";
24
+ EDiscogsCurrencyToIsoCode["NZD"] = "NZD";
16
25
  EDiscogsCurrencyToIsoCode["SEK"] = "SEK";
17
26
  EDiscogsCurrencyToIsoCode["ZAR"] = "ZAR";
18
- EDiscogsCurrencyToIsoCode["CA$"] = "CAD";
27
+ EDiscogsCurrencyToIsoCode["BRL"] = "BRL";
19
28
  EDiscogsCurrencyToIsoCode["A$"] = "AUD";
20
29
  EDiscogsCurrencyToIsoCode["R$"] = "BRL";
30
+ EDiscogsCurrencyToIsoCode["EUR"] = "EUR";
21
31
  EDiscogsCurrencyToIsoCode["\u20AC"] = "EUR";
22
32
  EDiscogsCurrencyToIsoCode["$"] = "USD";
23
33
  EDiscogsCurrencyToIsoCode["\u00A3"] = "GBP";
@@ -42,11 +42,11 @@ export default class Marketplace {
42
42
  */
43
43
  private serializeParams;
44
44
  /**
45
- * Function to convert devise to ISO name
45
+ * Function to convert currency to ISO name
46
46
  * @param str String to clean
47
47
  * @returns Cleanup string
48
48
  */
49
- private convertDevise;
49
+ private convertCurrency;
50
50
  /**
51
51
  * Parse HTML to clean result
52
52
  * @param document Document to parse
@@ -31,8 +31,8 @@ const IYears_1 = __importDefault(require("./interface/IYears"));
31
31
  const TLimit_1 = __importDefault(require("./type/TLimit"));
32
32
  const playwright_chromium_1 = require("playwright-chromium");
33
33
  const user_agents_1 = __importDefault(require("user-agents"));
34
- const EDiscogsCurrencyToIsoCode_1 = __importDefault(require("./enum/iso/translates/EDiscogsCurrencyToIsoCode"));
35
- const EDiscogsCountryNameToIsoCode_1 = __importDefault(require("./enum/iso/translates/EDiscogsCountryNameToIsoCode"));
34
+ const EDiscogsCurrencyToIsoCode_1 = __importDefault(require("./enum/iso/translate/EDiscogsCurrencyToIsoCode"));
35
+ const EDiscogsCountryNameToIsoCode_1 = __importDefault(require("./enum/iso/translate/EDiscogsCountryNameToIsoCode"));
36
36
  const linkedom_1 = require("linkedom");
37
37
  /**
38
38
  * Discogs Marketplace
@@ -113,7 +113,7 @@ class Marketplace {
113
113
  /** Get url */
114
114
  this.url = page.url();
115
115
  /** Get HTML */
116
- const bodyHTML = yield page.evaluate(() => { var _a; return (_a = document.querySelector('table.table_block')) === null || _a === void 0 ? void 0 : _a.outerHTML; });
116
+ const bodyHTML = yield page.evaluate(() => { var _a; return (_a = document.getElementById('page_content')) === null || _a === void 0 ? void 0 : _a.outerHTML; });
117
117
  /** Close browser */
118
118
  yield browser.close();
119
119
  /** If error, reject */
@@ -131,7 +131,7 @@ class Marketplace {
131
131
  };
132
132
  // eslint-disable-next-line @typescript-eslint/no-throw-literal
133
133
  throw {
134
- message: 'An error occured',
134
+ message: (error === null || error === void 0 ? void 0 : error.message) || 'An error occured',
135
135
  code: 500,
136
136
  };
137
137
  }
@@ -180,19 +180,24 @@ class Marketplace {
180
180
  return param.join('&');
181
181
  }
182
182
  /**
183
- * Function to convert devise to ISO name
183
+ * Function to convert currency to ISO name
184
184
  * @param str String to clean
185
185
  * @returns Cleanup string
186
186
  */
187
187
  // eslint-disable-next-line class-methods-use-this
188
- convertDevise(value) {
188
+ convertCurrency(value) {
189
189
  var _a;
190
190
  if (!value)
191
191
  return value;
192
192
  const currency = (_a = Object.keys(EDiscogsCurrencyToIsoCode_1.default).find(key => value.includes(key))) !== null && _a !== void 0 ? _a : '';
193
193
  if (!currency)
194
194
  return value;
195
- return `${value.replace(currency, '')} ${EDiscogsCurrencyToIsoCode_1.default[currency]}`.replace(/\s\s+/g, ' ');
195
+ const amount = value
196
+ .replace(/[.](?=.*[.])/g, '') // Remove all dot but last
197
+ .replace(currency, '') // Remove original currency
198
+ .replace(/\s/g, ''); // Remove spaces
199
+ return `${amount} ${EDiscogsCurrencyToIsoCode_1.default[currency]}`
200
+ .replace(/\s\s+/g, ' '); // Remove useless spaces
196
201
  }
197
202
  /**
198
203
  * Parse HTML to clean result
@@ -204,62 +209,61 @@ class Marketplace {
204
209
  const totalItems = parseFloat(((_d = (_c = (_b = (_a = document.querySelector('.pagination_total')) === null || _a === void 0 ? void 0 : _a.textContent) === null || _b === void 0 ? void 0 : _b.split(' ')) === null || _c === void 0 ? void 0 : _c.filter((x) => x).pop()) === null || _d === void 0 ? void 0 : _d.replace(/(,|\.|\s)/g, '')) || '0');
205
210
  return {
206
211
  items: ((_e = [...document.querySelectorAll('table.table_block tbody tr')]) === null || _e === void 0 ? void 0 : _e.map(el => {
207
- var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l, _m, _o, _p, _q, _r, _s, _t, _u, _v, _w, _x, _y, _z, _0, _1, _2, _3, _4, _5, _6, _7, _8, _9, _10, _11, _12, _13, _14, _15, _16, _17, _18, _19, _20, _21, _22, _23, _24, _25, _26, _27, _28, _29, _30, _31, _32, _33, _34, _35, _36, _37, _38, _39, _40, _41, _42, _43, _44, _45, _46, _47, _48, _49, _50, _51, _52, _53, _54, _55, _56, _57, _58, _59, _60;
208
- const shipping = this.convertDevise((_g = (_f = (_e = (_d = (_c = (_b = (_a = el.querySelector('.item_shipping')) === null || _a === void 0 ? void 0 : _a.childNodes) === null || _b === void 0 ? void 0 : _b[0]) === null || _c === void 0 ? void 0 : _c.textContent) === null || _d === void 0 ? void 0 : _d.replace(/(\s+|\+)/g, ' ')) === null || _e === void 0 ? void 0 : _e.trim()) === null || _f === void 0 ? void 0 : _f.replace(',', '.')) !== null && _g !== void 0 ? _g : '');
212
+ var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l, _m, _o, _p, _q, _r, _s, _t, _u, _v, _w, _x, _y, _z, _0, _1, _2, _3, _4, _5, _6, _7, _8, _9, _10, _11, _12, _13, _14, _15, _16, _17, _18, _19, _20, _21, _22, _23, _24, _25, _26, _27, _28, _29, _30, _31, _32, _33, _34, _35, _36, _37, _38, _39, _40, _41, _42, _43, _44, _45, _46, _47, _48, _49, _50, _51, _52, _53, _54, _55, _56, _57, _58, _59;
213
+ const shipping = this.convertCurrency((_g = (_f = (_e = (_d = (_c = (_b = (_a = el.querySelector('.item_shipping')) === null || _a === void 0 ? void 0 : _a.childNodes) === null || _b === void 0 ? void 0 : _b[0]) === null || _c === void 0 ? void 0 : _c.textContent) === null || _d === void 0 ? void 0 : _d.replace(/(\s+|\+)/g, ' ')) === null || _e === void 0 ? void 0 : _e.trim()) === null || _f === void 0 ? void 0 : _f.replace(',', '.')) !== null && _g !== void 0 ? _g : '');
209
214
  const have = Number.parseInt((_j = (_h = el.querySelector('.community_summary .community_result:nth-child(1) .community_number')) === null || _h === void 0 ? void 0 : _h.textContent) !== null && _j !== void 0 ? _j : '', 10);
210
215
  const want = Number.parseInt((_l = (_k = el.querySelector('.community_summary .community_result:nth-child(2) .community_number')) === null || _k === void 0 ? void 0 : _k.textContent) !== null && _l !== void 0 ? _l : '', 10);
211
216
  const countryName = (_q = (_p = (_o = (_m = el.querySelector('.seller_info li:nth-child(3)')) === null || _m === void 0 ? void 0 : _m.textContent) === null || _o === void 0 ? void 0 : _o.split(':')) === null || _p === void 0 ? void 0 : _p[1]) !== null && _q !== void 0 ? _q : '';
212
- const isoCountryCode = ((_r = Object.keys(ECountryCode_1.default)
213
- .find((key) => ECountryName_1.default[key] === countryName
214
- || EDiscogsCountryNameToIsoCode_1.default[countryName])) !== null && _r !== void 0 ? _r : '');
215
- const releaseId = Number.parseInt((_w = (_v = (_u = (_t = (_s = el.querySelector('a.item_release_link')) === null || _s === void 0 ? void 0 : _s.href.split('release/')) === null || _t === void 0 ? void 0 : _t.pop()) === null || _u === void 0 ? void 0 : _u.split('-')) === null || _v === void 0 ? void 0 : _v.shift()) !== null && _w !== void 0 ? _w : '0', 10);
216
- const itemId = Number.parseInt((_z = (_y = (_x = el.querySelector('a.item_description_title')) === null || _x === void 0 ? void 0 : _x.href) === null || _y === void 0 ? void 0 : _y.split('/').pop()) !== null && _z !== void 0 ? _z : '0', 10);
217
- const notes = Number.parseInt((_6 = (_5 = (_4 = (_3 = (_2 = (_1 = (_0 = el.querySelector('.seller_info li:nth-child(2) .section_link')) === null || _0 === void 0 ? void 0 : _0.textContent) === null || _1 === void 0 ? void 0 : _1.replace(/\s+/g, ' ')) === null || _2 === void 0 ? void 0 : _2.trim()) === null || _3 === void 0 ? void 0 : _3.split(' ')) === null || _4 === void 0 ? void 0 : _4[0]) === null || _5 === void 0 ? void 0 : _5.replace(/,/g, '')) !== null && _6 !== void 0 ? _6 : '', 10);
218
- const originalTitle = (_7 = el.querySelector('a.item_description_title')) === null || _7 === void 0 ? void 0 : _7.textContent;
219
- const firstIndexOfDash = (_8 = originalTitle === null || originalTitle === void 0 ? void 0 : originalTitle.indexOf(' - ')) !== null && _8 !== void 0 ? _8 : -1;
220
- const lastIndexOfParenthesis = (_9 = originalTitle === null || originalTitle === void 0 ? void 0 : originalTitle.lastIndexOf(' (')) !== null && _9 !== void 0 ? _9 : -1;
217
+ const isoCountryCode = (Object.keys(ECountryCode_1.default).find((key) => (ECountryName_1.default[key] === countryName))
218
+ || EDiscogsCountryNameToIsoCode_1.default[countryName]);
219
+ const releaseId = Number.parseInt((_v = (_u = (_t = (_s = (_r = el.querySelector('a.item_release_link')) === null || _r === void 0 ? void 0 : _r.href.split('release/')) === null || _s === void 0 ? void 0 : _s.pop()) === null || _t === void 0 ? void 0 : _t.split('-')) === null || _u === void 0 ? void 0 : _u.shift()) !== null && _v !== void 0 ? _v : '0', 10);
220
+ const itemId = Number.parseInt((_y = (_x = (_w = el.querySelector('a.item_description_title')) === null || _w === void 0 ? void 0 : _w.href) === null || _x === void 0 ? void 0 : _x.split('/').pop()) !== null && _y !== void 0 ? _y : '0', 10);
221
+ const notes = Number.parseInt((_5 = (_4 = (_3 = (_2 = (_1 = (_0 = (_z = el.querySelector('.seller_info li:nth-child(2) .section_link')) === null || _z === void 0 ? void 0 : _z.textContent) === null || _0 === void 0 ? void 0 : _0.replace(/\s+/g, ' ')) === null || _1 === void 0 ? void 0 : _1.trim()) === null || _2 === void 0 ? void 0 : _2.split(' ')) === null || _3 === void 0 ? void 0 : _3[0]) === null || _4 === void 0 ? void 0 : _4.replace(/,/g, '')) !== null && _5 !== void 0 ? _5 : '', 10);
222
+ const originalTitle = (_6 = el.querySelector('a.item_description_title')) === null || _6 === void 0 ? void 0 : _6.textContent;
223
+ const firstIndexOfDash = (_7 = originalTitle === null || originalTitle === void 0 ? void 0 : originalTitle.indexOf(' - ')) !== null && _7 !== void 0 ? _7 : -1;
224
+ const lastIndexOfParenthesis = (_8 = originalTitle === null || originalTitle === void 0 ? void 0 : originalTitle.lastIndexOf(' (')) !== null && _8 !== void 0 ? _8 : -1;
221
225
  return {
222
226
  itemId: Number.isNaN(itemId) ? 0 : itemId,
223
227
  title: {
224
228
  original: originalTitle !== null && originalTitle !== void 0 ? originalTitle : '',
225
- artist: (_10 = originalTitle === null || originalTitle === void 0 ? void 0 : originalTitle.substring(0, firstIndexOfDash)) !== null && _10 !== void 0 ? _10 : '',
229
+ artist: (_9 = originalTitle === null || originalTitle === void 0 ? void 0 : originalTitle.substring(0, firstIndexOfDash)) !== null && _9 !== void 0 ? _9 : '',
226
230
  item: firstIndexOfDash > -1 && lastIndexOfParenthesis > -1
227
- ? (_11 = originalTitle === null || originalTitle === void 0 ? void 0 : originalTitle.substring(firstIndexOfDash + 3, lastIndexOfParenthesis)) !== null && _11 !== void 0 ? _11 : ''
231
+ ? (_10 = originalTitle === null || originalTitle === void 0 ? void 0 : originalTitle.substring(firstIndexOfDash + 3, lastIndexOfParenthesis)) !== null && _10 !== void 0 ? _10 : ''
228
232
  : '',
229
233
  formats: lastIndexOfParenthesis > -1
230
- ? ((_13 = (_12 = originalTitle === null || originalTitle === void 0 ? void 0 : originalTitle.substring(lastIndexOfParenthesis + 2, originalTitle.length - 1)) === null || _12 === void 0 ? void 0 : _12.split(', ')) !== null && _13 !== void 0 ? _13 : [])
234
+ ? ((_12 = (_11 = originalTitle === null || originalTitle === void 0 ? void 0 : originalTitle.substring(lastIndexOfParenthesis + 2, originalTitle.length - 1)) === null || _11 === void 0 ? void 0 : _11.split(', ')) !== null && _12 !== void 0 ? _12 : [])
231
235
  : [],
232
236
  },
233
- url: `https://www.discogs.com${(_14 = el.querySelector('a.item_description_title')) === null || _14 === void 0 ? void 0 : _14.href}`,
234
- labels: (_16 = (_15 = [...el.querySelectorAll('.label_and_cat a[href^=\'https://www.discogs.com/\']')]) === null || _15 === void 0 ? void 0 : _15.map(x => { var _a; return (_a = x === null || x === void 0 ? void 0 : x.textContent) !== null && _a !== void 0 ? _a : ''; })) === null || _16 === void 0 ? void 0 : _16.filter((value, index, self) => self.indexOf(value) === index),
235
- catnos: (_21 = (_20 = (_19 = (_18 = (_17 = el.querySelector('.label_and_cat .item_catno')) === null || _17 === void 0 ? void 0 : _17.textContent) === null || _18 === void 0 ? void 0 : _18.replace(/\s+/g, ' ')) === null || _19 === void 0 ? void 0 : _19.split(', ')) === null || _20 === void 0 ? void 0 : _20.filter(x => x !== 'none')) !== null && _21 !== void 0 ? _21 : [],
236
- imageUrl: (_23 = (_22 = el.querySelector('.marketplace_image')) === null || _22 === void 0 ? void 0 : _22.getAttribute('data-src')) !== null && _23 !== void 0 ? _23 : '',
237
- description: (_28 = (_27 = (_26 = (_25 = (_24 = el.querySelector('.item_condition')) === null || _24 === void 0 ? void 0 : _24.nextElementSibling) === null || _25 === void 0 ? void 0 : _25.textContent) === null || _26 === void 0 ? void 0 : _26.replace(/\s+/g, ' ')) === null || _27 === void 0 ? void 0 : _27.trim()) !== null && _28 !== void 0 ? _28 : '',
238
- isAcceptingOffer: ((_32 = (_31 = (_30 = (_29 = el.querySelector('.item_add_to_cart p a strong')) === null || _29 === void 0 ? void 0 : _29.textContent) === null || _30 === void 0 ? void 0 : _30.split('/')) === null || _31 === void 0 ? void 0 : _31.length) !== null && _32 !== void 0 ? _32 : 0) > 1,
239
- isAvailable: !((_33 = el.classList) === null || _33 === void 0 ? void 0 : _33.contains('unavailable')),
237
+ url: `https://www.discogs.com${(_13 = el.querySelector('a.item_description_title')) === null || _13 === void 0 ? void 0 : _13.href}`,
238
+ labels: (_15 = (_14 = [...el.querySelectorAll('.label_and_cat a[href^=\'https://www.discogs.com/\']')]) === null || _14 === void 0 ? void 0 : _14.map(x => { var _a; return (_a = x === null || x === void 0 ? void 0 : x.textContent) !== null && _a !== void 0 ? _a : ''; })) === null || _15 === void 0 ? void 0 : _15.filter((value, index, self) => self.indexOf(value) === index),
239
+ catnos: (_20 = (_19 = (_18 = (_17 = (_16 = el.querySelector('.label_and_cat .item_catno')) === null || _16 === void 0 ? void 0 : _16.textContent) === null || _17 === void 0 ? void 0 : _17.replace(/\s+/g, ' ')) === null || _18 === void 0 ? void 0 : _18.split(', ')) === null || _19 === void 0 ? void 0 : _19.filter(x => x !== 'none')) !== null && _20 !== void 0 ? _20 : [],
240
+ imageUrl: (_22 = (_21 = el.querySelector('.marketplace_image')) === null || _21 === void 0 ? void 0 : _21.getAttribute('data-src')) !== null && _22 !== void 0 ? _22 : '',
241
+ description: (_27 = (_26 = (_25 = (_24 = (_23 = el.querySelector('.item_condition')) === null || _23 === void 0 ? void 0 : _23.nextElementSibling) === null || _24 === void 0 ? void 0 : _24.textContent) === null || _25 === void 0 ? void 0 : _25.replace(/\s+/g, ' ')) === null || _26 === void 0 ? void 0 : _26.trim()) !== null && _27 !== void 0 ? _27 : '',
242
+ isAcceptingOffer: ((_31 = (_30 = (_29 = (_28 = el.querySelector('.item_add_to_cart p a strong')) === null || _28 === void 0 ? void 0 : _28.textContent) === null || _29 === void 0 ? void 0 : _29.split('/')) === null || _30 === void 0 ? void 0 : _30.length) !== null && _31 !== void 0 ? _31 : 0) > 1,
243
+ isAvailable: !((_32 = el.classList) === null || _32 === void 0 ? void 0 : _32.contains('unavailable')),
240
244
  condition: {
241
245
  media: {
242
- full: (_37 = (_36 = (_35 = (_34 = el.querySelector('.item_condition span:nth-child(3)')) === null || _34 === void 0 ? void 0 : _34.textContent) === null || _35 === void 0 ? void 0 : _35.replace(/\s+/g, ' ')) === null || _36 === void 0 ? void 0 : _36.trim()) !== null && _37 !== void 0 ? _37 : '',
243
- short: (_43 = (_42 = (_41 = (_40 = (_39 = (_38 = el.querySelector('.item_condition span:nth-child(3)')) === null || _38 === void 0 ? void 0 : _38.textContent) === null || _39 === void 0 ? void 0 : _39.replace(/\s+/g, ' ')) === null || _40 === void 0 ? void 0 : _40.trim()) === null || _41 === void 0 ? void 0 : _41.match(/\(([^)]+)\)/)) === null || _42 === void 0 ? void 0 : _42[1]) !== null && _43 !== void 0 ? _43 : '',
246
+ full: (_36 = (_35 = (_34 = (_33 = el.querySelector('.item_condition span:nth-child(3)')) === null || _33 === void 0 ? void 0 : _33.textContent) === null || _34 === void 0 ? void 0 : _34.replace(/\s+/g, ' ')) === null || _35 === void 0 ? void 0 : _35.trim()) !== null && _36 !== void 0 ? _36 : '',
247
+ short: (_42 = (_41 = (_40 = (_39 = (_38 = (_37 = el.querySelector('.item_condition span:nth-child(3)')) === null || _37 === void 0 ? void 0 : _37.textContent) === null || _38 === void 0 ? void 0 : _38.replace(/\s+/g, ' ')) === null || _39 === void 0 ? void 0 : _39.trim()) === null || _40 === void 0 ? void 0 : _40.match(/\(([^)]+)\)/)) === null || _41 === void 0 ? void 0 : _41[1]) !== null && _42 !== void 0 ? _42 : '',
244
248
  },
245
249
  sleeve: {
246
- full: (_45 = (_44 = el.querySelector('.item_condition span.item_sleeve_condition')) === null || _44 === void 0 ? void 0 : _44.textContent) !== null && _45 !== void 0 ? _45 : '',
247
- short: (_49 = (_48 = (_47 = (_46 = el.querySelector('.item_condition span.item_sleeve_condition')) === null || _46 === void 0 ? void 0 : _46.textContent) === null || _47 === void 0 ? void 0 : _47.match(/\(([^)]+)\)/)) === null || _48 === void 0 ? void 0 : _48[1]) !== null && _49 !== void 0 ? _49 : '',
250
+ full: (_44 = (_43 = el.querySelector('.item_condition span.item_sleeve_condition')) === null || _43 === void 0 ? void 0 : _43.textContent) !== null && _44 !== void 0 ? _44 : '',
251
+ short: (_48 = (_47 = (_46 = (_45 = el.querySelector('.item_condition span.item_sleeve_condition')) === null || _45 === void 0 ? void 0 : _45.textContent) === null || _46 === void 0 ? void 0 : _46.match(/\(([^)]+)\)/)) === null || _47 === void 0 ? void 0 : _47[1]) !== null && _48 !== void 0 ? _48 : '',
248
252
  },
249
253
  },
250
254
  seller: {
251
- name: (_51 = (_50 = el.querySelector('.seller_info a')) === null || _50 === void 0 ? void 0 : _50.textContent) !== null && _51 !== void 0 ? _51 : '',
252
- url: `https://www.discogs.com${(_52 = el.querySelector('.seller_info a')) === null || _52 === void 0 ? void 0 : _52.href}`,
253
- score: (_54 = (_53 = el.querySelector('.seller_info li:nth-child(2) strong')) === null || _53 === void 0 ? void 0 : _53.textContent) !== null && _54 !== void 0 ? _54 : '',
255
+ name: (_50 = (_49 = el.querySelector('.seller_info a')) === null || _49 === void 0 ? void 0 : _49.textContent) !== null && _50 !== void 0 ? _50 : '',
256
+ url: `https://www.discogs.com${(_51 = el.querySelector('.seller_info a')) === null || _51 === void 0 ? void 0 : _51.href}`,
257
+ score: (_53 = (_52 = el.querySelector('.seller_info li:nth-child(2) strong')) === null || _52 === void 0 ? void 0 : _52.textContent) !== null && _53 !== void 0 ? _53 : '',
254
258
  notes: Number.isNaN(notes) ? 0 : notes,
255
259
  },
256
260
  price: {
257
- base: this.convertDevise((_58 = (_57 = (_56 = (_55 = el.querySelector('.price')) === null || _55 === void 0 ? void 0 : _55.textContent) === null || _56 === void 0 ? void 0 : _56.replace(/\s+/g, ' ')) === null || _57 === void 0 ? void 0 : _57.replace(/,/, '.')) !== null && _58 !== void 0 ? _58 : ''),
261
+ base: this.convertCurrency((_57 = (_56 = (_55 = (_54 = el.querySelector('.price')) === null || _54 === void 0 ? void 0 : _54.textContent) === null || _55 === void 0 ? void 0 : _55.replace(/\s+/g, ' ')) === null || _56 === void 0 ? void 0 : _56.replace(/,/, '.')) !== null && _57 !== void 0 ? _57 : ''),
258
262
  shipping: Number.isNaN(parseFloat(shipping)) ? null : shipping,
259
263
  },
260
264
  from: {
261
265
  countryName,
262
- isoCountryName: (_59 = ECountryName_1.default[isoCountryCode]) !== null && _59 !== void 0 ? _59 : '',
266
+ isoCountryName: (_58 = ECountryName_1.default[isoCountryCode]) !== null && _58 !== void 0 ? _58 : '',
263
267
  isoCountryCode,
264
268
  },
265
269
  community: {
@@ -268,7 +272,7 @@ class Marketplace {
268
272
  },
269
273
  release: {
270
274
  id: Number.isNaN(releaseId) ? 0 : releaseId,
271
- url: `https://www.discogs.com${(_60 = el.querySelector('a.item_release_link')) === null || _60 === void 0 ? void 0 : _60.href}`,
275
+ url: `https://www.discogs.com${(_59 = el.querySelector('a.item_release_link')) === null || _59 === void 0 ? void 0 : _59.href}`,
272
276
  },
273
277
  };
274
278
  })) || [],
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "discogs-marketplace-api-nodejs",
3
- "version": "1.3.4",
3
+ "version": "1.3.7",
4
4
  "description": "Another (better ?) NodeJs library to fetch data from Discog's marketplace",
5
5
  "keywords": [
6
6
  "discogs",
@@ -26,27 +26,26 @@
26
26
  "main": "dist/index.js",
27
27
  "types": "dist/index.d.ts",
28
28
  "dependencies": {
29
- "linkedom": "^0.13.0",
30
- "playwright-chromium": "^1.17.1",
31
- "ts-node": "^10.4.0",
29
+ "linkedom": "^0.14.2",
30
+ "playwright-chromium": "^1.19.2",
31
+ "ts-node": "^10.5.0",
32
32
  "tsconfig-paths": "^3.12.0",
33
- "user-agents": "^1.0.889"
33
+ "user-agents": "^1.0.940"
34
34
  },
35
35
  "devDependencies": {
36
- "@types/jest": "^27.4.0",
37
- "@types/node": "^17.0.8",
38
- "@types/puppeteer": "^5.4.4",
36
+ "@types/jest": "^27.4.1",
37
+ "@types/node": "^17.0.21",
39
38
  "@types/user-agents": "^1.0.2",
40
- "@typescript-eslint/eslint-plugin": "^5.9.0",
41
- "@typescript-eslint/parser": "^5.9.0",
42
- "eslint": "^8.6.0",
39
+ "@typescript-eslint/eslint-plugin": "^5.12.1",
40
+ "@typescript-eslint/parser": "^5.12.1",
41
+ "eslint": "^8.10.0",
43
42
  "eslint-config-airbnb-base": "^15.0.0",
44
43
  "eslint-config-airbnb-typescript": "^16.1.0",
45
44
  "eslint-plugin-import": "^2.25.4",
46
- "jest": "^27.4.7",
47
- "ts-jest": "^27.1.2",
45
+ "jest": "^27.5.1",
46
+ "ts-jest": "^27.1.3",
48
47
  "ttypescript": "^1.5.13",
49
- "typescript": "^4.5.4",
48
+ "typescript": "^4.5.5",
50
49
  "typescript-transform-paths": "^3.3.1"
51
50
  }
52
51
  }