Initial commit
This commit is contained in:
1
.gitignore
vendored
Normal file
1
.gitignore
vendored
Normal file
@@ -0,0 +1 @@
|
|||||||
|
node_modules
|
||||||
6
getPrice.js
Normal file
6
getPrice.js
Normal file
@@ -0,0 +1,6 @@
|
|||||||
|
module.exports = async function(page, url) {
|
||||||
|
await page.goto(url);
|
||||||
|
const element = await page.waitForSelector('b.price')
|
||||||
|
const value = await element.evaluate(el => el.textContent);
|
||||||
|
return Number(value)
|
||||||
|
}
|
||||||
24
index.js
Normal file
24
index.js
Normal file
@@ -0,0 +1,24 @@
|
|||||||
|
const puppeteer = require('puppeteer');
|
||||||
|
const getPrice = require('./getPrice');
|
||||||
|
const items = require("./items");
|
||||||
|
|
||||||
|
const marketUrl = 'https://warframe.market/items/';
|
||||||
|
|
||||||
|
(async () => {
|
||||||
|
const browser = await puppeteer.launch({ headless: false });
|
||||||
|
const page = await browser.newPage();
|
||||||
|
|
||||||
|
for (item of items) {
|
||||||
|
let partsPrice = 0
|
||||||
|
for (part of item.parts) {
|
||||||
|
partsPrice += await getPrice(page, marketUrl + part.url);
|
||||||
|
}
|
||||||
|
|
||||||
|
const setPrice = await getPrice(page, marketUrl + item.url)
|
||||||
|
if (partsPrice < setPrice) {
|
||||||
|
console.log(item.name, partsPrice, setPrice)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
await browser.close();
|
||||||
|
})();
|
||||||
12
items/Item.js
Normal file
12
items/Item.js
Normal file
@@ -0,0 +1,12 @@
|
|||||||
|
module.exports = class Item {
|
||||||
|
constructor(name) {
|
||||||
|
this.name = name
|
||||||
|
this.url = `${this.name}_prime_set`
|
||||||
|
this.parts = []
|
||||||
|
this.addPart('blueprint')
|
||||||
|
}
|
||||||
|
|
||||||
|
addPart(part) {
|
||||||
|
this.parts.push({ part, url: `${this.name}_prime_${part}` })
|
||||||
|
}
|
||||||
|
}
|
||||||
11
items/Warframe.js
Normal file
11
items/Warframe.js
Normal file
@@ -0,0 +1,11 @@
|
|||||||
|
const Item = require("./Item");
|
||||||
|
|
||||||
|
module.exports = class Warframe extends Item {
|
||||||
|
constructor(name) {
|
||||||
|
super(name)
|
||||||
|
|
||||||
|
this.addPart('systems')
|
||||||
|
this.addPart('neuroptics')
|
||||||
|
this.addPart('chassis')
|
||||||
|
}
|
||||||
|
}
|
||||||
6
items/index.js
Normal file
6
items/index.js
Normal file
@@ -0,0 +1,6 @@
|
|||||||
|
const Warframe = require("./Warframe");
|
||||||
|
|
||||||
|
module.exports = [
|
||||||
|
new Warframe('ash'),
|
||||||
|
new Warframe('atlas'),
|
||||||
|
]
|
||||||
1040
package-lock.json
generated
Normal file
1040
package-lock.json
generated
Normal file
File diff suppressed because it is too large
Load Diff
14
package.json
Normal file
14
package.json
Normal file
@@ -0,0 +1,14 @@
|
|||||||
|
{
|
||||||
|
"name": "warframe-market-bot",
|
||||||
|
"version": "1.0.0",
|
||||||
|
"description": "",
|
||||||
|
"main": "index.js",
|
||||||
|
"scripts": {
|
||||||
|
"test": "echo \"Error: no test specified\" && exit 1"
|
||||||
|
},
|
||||||
|
"author": "Anatoly Kopyl",
|
||||||
|
"license": "ISC",
|
||||||
|
"dependencies": {
|
||||||
|
"puppeteer": "^13.3.2"
|
||||||
|
}
|
||||||
|
}
|
||||||
Reference in New Issue
Block a user