Tegos / travian-elephant-finder

Travian Animals Finder
MIT License
29 stars 15 forks source link

Unexpected end of JSON input #24

Open standerksen opened 1 year ago

standerksen commented 1 year ago

Following up on https://github.com/Tegos/travian-elephant-finder/issues/18, I still get this error when I run npm run collect. Issue exists for ts7.x1.international.travian.com server.

> travian-elephant@0.0.4 collect
> node src/scripts/collectOasysPosition.js

P:\TravianElephantFinder\node_modules\jsonfile\index.js:67
      throw err
      ^

SyntaxError: data/oasis.json: Unexpected end of JSON input
    at JSON.parse (<anonymous>)
    at Object.readFileSync (P:\TravianElephantFinder\node_modules\jsonfile\index.js:63:17)
    at Object.<anonymous> (P:\TravianElephantFinder\src\scripts\collectOasysPosition.js:11:30)
    at Module._compile (node:internal/modules/cjs/loader:1105:14)
    at Object.Module._extensions..js (node:internal/modules/cjs/loader:1159:10)
    at Module.load (node:internal/modules/cjs/loader:981:32)
    at Function.Module._load (node:internal/modules/cjs/loader:822:12)
    at Function.executeUserEntryPoint [as runMain] (node:internal/modules/run_main:77:12)
    at node:internal/main/run_main_module:17:47

I installed by using yarn install and npm run preinstal-windows. I have correctly set the .env file (correct server) and pasted my cookie in src/config/cookie.txt.

Kopilut commented 11 months ago

You will find this script working on my fork. Using 'fs.createWriteStream' before writing was a problem in src/scripts/cleanData.js

Tegos commented 11 months ago

Could you create pull request @BeneAlgirdas ?

Kopilut commented 11 months ago

Oh, hello. Just created one. Do you mean this project is still maintained? :D How about new features such as coordinates wrapping (when from e.g. y -200 it goes around decrementing from 200, from the top)?

Tegos commented 11 months ago

Hello. Yes, not so active, but still maintained. You may implement by yourself or describe feature and I'll try to add. :)

cheryiit commented 6 months ago

is it working now ? :)

Tegos commented 6 months ago

@cheryiit hello. Yes, should work. Did you try? 😄

cheryiit commented 6 months ago

There is no AjaxToken now whats the token? And for more less ban risk, maybe it should be first login api request then auth dorf1 map page and then mape api's maybe 🤔

LOGIN_API = "/api/v1/auth/login" AUTH_API = "/api/v1/auth/" MAIN_PAGE = "/dorf1.php" MAP_PAGE = "/karte.php" MAP_API = "/api/v1/map/position"

I am currently working on huge thing like a automaticly given best oasis to attack for x,y coordinates and with their attack links

Tegos commented 6 months ago

Hello, @cheryiit. I will check auth mechanism.