Giter Site home page Giter Site logo

Wrong JSON output about boxrec HOT 7 CLOSED

boxing avatar boxing commented on August 20, 2024
Wrong JSON output

from boxrec.

Comments (7)

benov84 avatar benov84 commented on August 20, 2024

the returning json contains html tags. how can i retrieve the correct json result? thank you

from boxrec.

mikedidomizio avatar mikedidomizio commented on August 20, 2024

So those are private variables, there should be getters that should be used. Depending on the method you are using, the documentation might help out - https://boxing.github.io/boxrec/classes/boxrec.html

There are examples of each method being used in the E2E test file located here - https://github.com/boxing/boxrec/blob/master/src/boxrec.class.spec.e2e.ts

If the above doesn't help, let me know what method you're using and what parameters.

from boxrec.

benov84 avatar benov84 commented on August 20, 2024

Hi, thank you for your fast reply.

This is my code (i've copied it from your examples):

app.get('/byId', function (req, res) {
    boxrec.login("user", "pass")
        .then(() => {
            boxrec.getPersonById(468841)
                .then(boxer => {
                    console.log(boxer);
                    res.end(boxer.name);
                });
        })
        .catch(error => {res.end("error logging")});  
})

Here boxer.name is OK, also boxer.record.win and so on...
But I want to get JSON with all the data for the boxer.
Thank you!

from boxrec.

benov84 avatar benov84 commented on August 20, 2024

{ id: 352, name: 'Floyd Mayweather Jr', alias: 'Money / Pretty Boy', record: { draw: 0, loss: 0, win: 50 }, last6: ['win', 'win', 'win', 'win', 'win', 'win'], division: 'welterweight', career: [1996, 2017], residence: { id: 20388, town: 'Las Vegas', region: 'NV', country: 'US' } } });

This is output from your example, but I can't get this result :)

from boxrec.

mikedidomizio avatar mikedidomizio commented on August 20, 2024

Your code above looks correct. In the first few versions there was a way to output all the data. I left the examples to show what data can be retrieved but currently there is not a way to output all the data like what you have. I haven't decided if it should be added back in. It's nice to have to show what all data there is, but I removed it because to use the data you still have to access it the same way as a getter.

from boxrec.

benov84 avatar benov84 commented on August 20, 2024

OK, I understand, it was my misunderstanding. Thank you very much! You've done great work! Keep it going. If I have time I would like to help with your project!

from boxrec.

mikedidomizio avatar mikedidomizio commented on August 20, 2024

No problem. Thanks for the compliments. Any help is appreciated.

from boxrec.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.