Output to file

This commit is contained in:
2022-02-16 00:17:19 +03:00
parent d47a4c634e
commit d5d5e5d59c
9 changed files with 82 additions and 15 deletions

View File

@@ -1,7 +1,8 @@
module.exports = class Part {
constructor (set, part) {
constructor (set, part, amount) {
this.part = part
this.url = `${set}_prime_${part}`
this.amount = amount ?? 1
}
async getPrice (page) {
@@ -10,6 +11,6 @@ module.exports = class Part {
await page.goto(marketUrl + this.url)
const element = await page.waitForSelector('b.price')
const value = await element.evaluate(el => el.textContent)
return Number(value)
return Number(value) * this.amount
}
}