0

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);
});

Im getting this output: enter image description here

And I need to get only this price: enter image description here

1
  • Are you sure the API doesn't allow to get only the sell price, do you know all the API routes ? Commented Nov 22, 2020 at 0:21

1 Answer 1

1

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

Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.