Switched to api from scraping
Some checks failed
continuous-integration/drone/push Build is failing

This commit is contained in:
2022-03-07 01:17:48 +03:00
parent f6d600e9ae
commit 7bfb00ad77
5 changed files with 148 additions and 831 deletions

View File

@@ -1,3 +1,5 @@
const Api = require('../api')
module.exports = class Part {
constructor (set, part, amount) {
this.part = part
@@ -5,12 +7,8 @@ module.exports = class 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
async getPrice () {
const orders = await Api.getSortedOrders(this.url)
return Number(orders[0].platinum) * this.amount
}
}