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

24
api.js Normal file
View File

@@ -0,0 +1,24 @@
const { default: axios } = require('axios')
class Api {
constructor () {
this.baseUrl = 'https://api.warframe.market/v1/'
this.timeout = 0
}
async getOrders (url) {
const response = await axios.get(this.baseUrl + 'items/' + url + '/orders')
return response.data.payload.orders.filter(function (order) {
return order.order_type === 'sell' && order.user.status !== 'offline'
})
}
async getSortedOrders (url) {
const orders = await this.getOrders(url)
return orders.sort(function (a, b) {
return a.platinum - b.platinum
})
}
}
module.exports = new Api()