boxing / boxrec

Retrieve information from BoxRec and return it in JSON format
MIT License
109 stars 18 forks source link

Can't login with credentials #299

Open FelixFreelancer opened 2 years ago

FelixFreelancer commented 2 years ago

Hi @mikedidomizio

The login function stops working for some reason. I've attached my code and errors given.

const boxrec = require("boxrec").Boxrec;

(async() => {
    try {

        const BOXREC_USERNAME = process.env.BOXREC_USERNAME;
        const BOXREC_PASSWORD = process.env.BOXREC_PASSWORD;
        const cookie = await boxrec.login(BOXREC_USERNAME , BOXREC_PASSWORD );

    } catch(e) {
        console.log(e)
    }
})();

When I run the code above, it gives this error for some reason.

Error: Could not get redirect URL
    at Function.<anonymous> (E:\boxrec\node_modules\boxrec-requests\dist\boxrec-requests.js:481:35)
    at step (E:\boxrec\node_modules\boxrec-requests\dist\boxrec-requests.js:33:23)
    at Object.next (E:\boxrec\node_modules\boxrec-requests\dist\boxrec-requests.js:14:53)
    at fulfilled (E:\boxrec\node_modules\boxrec-requests\dist\boxrec-requests.js:5:58)
    at processTicksAndRejections (node:internal/process/task_queues:96:5)

Thanks

mikedidomizio commented 2 years ago

This appears to be a result of BoxRec implementing CloudFlare to prevent bots. Not sure about a solution for this at this time.

FelixFreelancer commented 2 years ago

Is there a way to bypass it? Thanks

FelixFreelancer commented 2 years ago

If we get the cookie manually from the website, the rest function(getDate(), getBout()) will be able to work?

mikedidomizio commented 2 years ago

If we get the cookie manually from the website, the rest function(getDate(), getBout()) will be able to work?

It's worth a try to at least unblock you for now.

FelixFreelancer commented 2 years ago

I just tried it. but still gives the same error. I have another question. If I use a good proxy server, the issue might be resolved?

Thanks

mikedidomizio commented 2 years ago

I still think regardless the issue is still valid but any workaround might be fine until a full solution is figured out.

FelixFreelancer commented 2 years ago

If we get the cookie manually from the website, the rest function(getDate(), getBout()) will be able to work?

It's worth a try to at least unblock you for now.

I took a cookie from a web browser. And tried to get schedules by using it.

const cookie = "_ga=GA1.1.265210831.1656540311; wXw2E7NF36pq4KmR4Eu3LBIQNlH......";
let schedules2 = await boxrec.getDate(cookie, {
    day: 17,
    month: 7,
    year: 2022
});

But it still gives invalid results. Could you please check if I can use the cookie as a string itself taken from the website?

Thanks

FelixFreelancer commented 2 years ago

I also noticed that boxrec recently changed their website including layout and so on. Probably this issue is related to this?

Thanks

mikedidomizio commented 2 years ago

That's a separate issue and I can already tell there's going to be some stuff broken as a result of that.

As far as the CloudFlare stuff that resulted in Could not get redirect URL, I have a potential solution but it requires a bunch of testing.

No ETA on this.

FelixFreelancer commented 2 years ago

Hi @mikedidomizio

Could you kindly let me know when you'd like to upgrade the package? I really appreciate for your continuous upgrading this package.

Thanks

FelixFreelancer commented 2 years ago

Hi @mikedidomizio

Could you please let me know if there are any updates? Thanks

mikedidomizio commented 2 years ago

The only update I can give is the changes required to make the API requests from the underlying boxrec-requests package are still in (slow) progress.

mikedidomizio commented 1 year ago

Just an update on this since I can't promise much more work on it at this time, but in case someone wants to try and continue fixing it.

The underlying boxrec-requests has a puppeteer branch to try and fetch via puppeteer to handle captchas. It's not perfect but functions. This repository is still in need of having an update since the BoxRec website has changed visually.

debabrataroytechnoexponent commented 1 year ago

Facing same issue with all the versions.