Reputation: 71
im making a bot to get the price of the peso argentino. Im using a Api but im having some problems to get only the sell price.
if (command == "peso"){
request('https://www.dolarsi.com/api/api.php?type=valoresprincipales', (err, res, body) => {
const data = JSON.parse(body);
message.channel.send(body);
});
And I need to get only this price:
Upvotes: 0
Views: 45
Reputation: 8269
If you only want to get that particular sell price, you must be particular on what property you want to compare to get that sort of data.
Example:
const data = JSON.parse(body);
const item = data
.find(({ casa: { venta } }) => venta === "161,000")
.casa
.venta;
Attach is the Stackblitz Demo for your reference with the mock data in reference to your screenshot above
Upvotes: 1