iFraan / vandal.js

Wrapper for Valorant stats api
GNU General Public License v3.0
2 stars 1 forks source link

Unexpected token e in JSON at position 0 #1

Closed GoAwayGod closed 2 years ago

GoAwayGod commented 2 years ago

receiving an Unexpected token e in JSON at position 0

image

iFraan commented 2 years ago

Looks like the site is blocking curl from accessing it. Can you try using the url in your browser? (changing the username and tag) https://api.tracker.gg/api/v2/valorant/standard/profile/riot/{USERNAME}%23{TAG} I've updated the user-agent to a more modern one so updating the module using npm i vandal.js maybe would fix it.

GoAwayGod commented 2 years ago

image using link: https://api.tracker.gg/api/v2/valorant/standard/profile/riot/iFraan_%23G4G when i access it from a browser, it works fine. i am able to see the JSON. image however when I use it in the bot, it returns this error

iFraan commented 2 years ago

try to open a terminal and use curl --max-time 5 --user-agent 'Chrome/99' --url https://api.tracker.gg/api/v2/valorant/standard/profile/riot/iFraan%23G4G Or try updating curl with https://curl.se/windows/dl-7.83.1/curl-7.83.1-win64-mingw.zip

iFraan commented 2 years ago

also, make sure you dont have a curl file (even if end with js) in your root folder, so it uses the one in the default path

GoAwayGod commented 2 years ago

running the

try to open a terminal and use curl --max-time 5 --user-agent 'Chrome/99' --url https://api.tracker.gg/api/v2/valorant/standard/profile/riot/iFraan%23G4G Or try updating curl with https://curl.se/windows/dl-7.83.1/curl-7.83.1-win64-mingw.zip

Running this returned error code: 1020

currently the version of curl im using is 7.79.1 (Windows) libcurl/7.79.1 Schannel

there is no exe to run in the curl file, also the readme is not clear on where to use this file

iFraan commented 2 years ago

Usage is simple, you install the package with npm i vandal.js and call the functions. Error 1020 means cloudfare is forbiding your connection. Closing this since i cant replicate in either of my 3 machines (win10, win11 and ubuntu).