Files
warframe-center/items/Part.js
2022-02-16 00:17:19 +03:00

17 lines
450 B
JavaScript

module.exports = class Part {
constructor (set, part, amount) {
this.part = part
this.url = `${set}_prime_${part}`
this.amount = amount ?? 1
}
async getPrice (page) {
const marketUrl = 'https://warframe.market/items/'
await page.goto(marketUrl + this.url)
const element = await page.waitForSelector('b.price')
const value = await element.evaluate(el => el.textContent)
return Number(value) * this.amount
}
}