Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fetching JSON is blocked or return opaque answer #240

Open
lx78WyY0J5 opened this issue Jul 15, 2023 · 0 comments
Open

Fetching JSON is blocked or return opaque answer #240

lx78WyY0J5 opened this issue Jul 15, 2023 · 0 comments

Comments

@lx78WyY0J5
Copy link

lx78WyY0J5 commented Jul 15, 2023

Hi, recentrly i found this repo, the badge work when using in simple HTML,

But today i started to think about just grabing the JSON returned with some JS

The only way i could get an "answer" is by forcing 'NO-CORS' & CrossOrigin
But with this, it answer, but always an opaque "empty" response

I tested a LOT of way to fetch this .json that even my god damn browser show
But none either respond (blocked by cross-origine (while active) or by CORS), or they just respond this

Code :

    return new Promise(function (resolve, reject) {
        setTimeout(() => {
            fetch(url, {
                method: 'GET',
                crossorigin: true,
                mode: 'no-cors'
            })
                .then(response => console.log(response))
                .then(data => {
                    console.log(data);
                    return;
                })
                .catch(error => console.error(error))
        }, 1000);
    });
}
var global = await gather('https://hits.dwyl.com/abc/abc');  

Response
chrome_AlldM4NqMI


Edit : I tested it also with realTime page & console (to avoid running script from local IP 127.0.0.1...)
But same behavior


cURL work well and give me the raw JSON as answer after hitting cloudflare,


Forgot to mention that else, everything work perfectly 🤡 😢
Thx BTW for repo :octocat:

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants