pogodevorg / pgoapi-go Goto Github PK
View Code? Open in Web Editor NEWUnofficial PokemonGO API in Go
Home Page: https://pogodev.org
License: MIT License
Unofficial PokemonGO API in Go
Home Page: https://pogodev.org
License: MIT License
I received the following error when calling GetPlayerMap()
:
panic: runtime error: index out of range
goroutine 59 [running]:
panic(0x757360, 0xc420010130)
/usr/lib/go/src/runtime/panic.go:500 +0x1a1
github.com/pogodevorg/pgoapi-go/api.(_Session).Announce(0xc42017c0a0, 0x987960, 0xc420010578, 0x7a6060, 0x474a01, 0xc4204eee40)
/home/steven/programming/go/src/github.com/pogodevorg/pgoapi-go/api/session.go:276 +0x800
github.com/pogodevorg/pgoapi-go/api.(_Session).GetPlayerMap(0xc42017c0a0, 0x987960, 0xc420010578, 0xc4203c9cd0, 0x2, 0x2)
/home/steven/programming/go/src/github.com/pogodevorg/pgoapi-go/api/session.go:307 +0x3f
mogo-go/process.(_Worker).Run.func1()
/home/steven/programming/go/src/mogo-go/process/worker.go:54 +0x150
mogo-go/process.(_Worker).Run.func1()
/home/steven/programming/go/src/mogo-go/process/worker.go:77 +0x3b2
created by mogo-go/process.(*Worker).Run
/home/steven/programming/go/src/mogo-go/process/worker.go:80 +0xca
exit status 2
It seems to come from err = proto.Unmarshal(response.Returns[5], mapObjects)
in session.go
. I'm not sure why it occurred but it only happened once after a couple of hours of testing. Perhaps we should check if the slice contains the required amount of elements before trying to access it?
api.NewSession argument changed. *Feed is added.
How to use new interface?
Working on a branch to announce your location and retrieve map data: https://github.com/pkmngo-odi/pogo/tree/feature/announce-heartbeat
Still getting the Index out of range error in sessions.go, when accessing one of the Returns slice at index 0
This is the exact code:
package main
import (
"log"
"golang.org/x/net/context"
"github.com/pkmngo-odi/pogo/api"
"github.com/pkmngo-odi/pogo/auth"
)
func main() {
ctx := context.Background()
provider, err := auth.NewProvider("ptc", "xqaYVxmzdVD8AjS", "EGi9tUf8cmIOq9a")
if err != nil {
log.Println(err)
return
}
location := &api.Location{
Lon: 0.0,
Lat: 0.0,
Alt: 0.0,
}
feed := &api.VoidFeed{}
session := api.NewSession(provider, location, feed, false)
err = session.Init(ctx)
if err != nil {
log.Println(err)
return
}
_, err = session.GetPlayer(ctx)
if err != nil {
log.Println(err)
return
}
_, err = session.GetPlayerMap(ctx)
if err != nil {
log.Println(err)
return
}
_, err = session.Announce(ctx)
if err != nil {
log.Println(err)
return
}
}
The stacktrace:
Moddy:~/go/src/github.com/moddyz/pokemapgo$ go build -v . && ./pokemapgo
github.com/moddyz/pokemapgo
panic: runtime error: index out of range
goroutine 1 [running]:
panic(0x417620, 0xc82000a0b0)
/usr/local/go/src/runtime/panic.go:481 +0x3e6
github.com/pkmngo-odi/pogo/api.(*Session).GetPlayerMap(0xc820012640, 0x8951a0, 0xc82000a2a8, 0xc82042c2c0, 0x0, 0x0)
/Users/Moddy/go/src/github.com/pkmngo-odi/pogo/api/session.go:230 +0x5e8
main.main()
/Users/Moddy/go/src/github.com/moddyz/pokemapgo/main.go:43 +0x4c7
I am receiving the following error when attempting to run go get -u github.com/pokeintel/pogo
Cloning into 'POGOProtos'...
Permission denied (publickey).
fatal: Could not read from remote repository.Please make sure you have the correct access rights
and the repository exists.
fatal: clone of '[email protected]:AeonLucid/POGOProtos.git' into submodule path 'POGOProtos' failed
package github.com/pokeintel/pogo-protos: exit status 128
This could well be something to do with my setup, but I thought I'd ask here in case anyone else is getting the same thing.
I was looking at the code in this repo https://github.com/AHAAAAAAA/PokemonGo-Map and it looks like there each provider has a expiry time that can be queried.
https://github.com/AHAAAAAAA/PokemonGo-Map/blob/master/pogom/pgoapi/pgoapi.py#L178
Upon expiry it looks like the client relogs in.
It looks like it's part of the AuthTicket struct:
https://github.com/pkmngo-odi/pogo-protos/blob/master/networking_envelopes.pb.go#L48
Could we possibly expose that on the session object so we know when to login again?
Do let me know if I'm not understanding Session properly :)
It seems like the protobuffs have changed, I'm getting the following errors:
../github.com/pokeintel/pogo/api/session.go:147: cannot use requestHash (type []uint64) as type []int64 in field value
../github.com/pokeintel/pogo/api/session.go:148: cannot use locationHash1 (type uint32) as type uint64 in field value
../github.com/pokeintel/pogo/api/session.go:149: cannot use locationHash2 (type uint32) as type uint64 in field value
../github.com/pokeintel/pogo/api/session.go:150: unknown protos.Signature field 'Unknown22' in struct literal
Why is there no provided crypto solution? Other APIs have a provided crypto solution so I was just curious why this one doesn't.
Reproduction (basically run the example code provided on README.md):
About half the time I'm getting the error "The profile needs to be authorized" returning from those method calls in 3.
The provider is definitely valid because the other half the time the call returns the player data / map data successfully.
Any ideas? Is there any more info I could provide?
Why not use neighbors?
Hey,
Don't know how else to come in contact, but what is the idea behind the cell ids? Do you create a grid on the map and then determine the location within the grid?
Really learning a lot from your code base, trying to find my place in doing actual contributions (just a beginner in golang).
Thanks for the inspiration anyway!
I'm doing session.GetPlayerMap(ctx)
and then iterating over the cells and calling GetWildPokemons()
but nothing is being returned. Is anyone else having the same problem?
when I call GetPlayerMap() only get this return
{"map_cells":[{"s2_cell_id":6251754337001799680,"current_timestamp_ms":1472965820289},{"s2_cell_id":6251754343444250624,"current_timestamp_ms":1472965820289},{"s2_cell_id":6251754341296766976,"current_timestamp_ms":1472965820289},{"s2_cell_id":6251754332706832384,"current_timestamp_ms":1472965820289},{"s2_cell_id":6251754345591734272,"current_timestamp_ms":1472965820289}],"status":1}
is this right?
To reproduce, basically set up a valid Session, initialize it, and call GetPlayerMap or Announce.
Error message:
The response could not be read: proto: bad wiretype for field protos.GetMapObjectsResponse.MapCells: got wiretype 0, want 2
Reproduction:
It seems that protos.ResponseEnvelope.Returns could at times be an empty slice?
Stacktrace:
panic: runtime error: index out of range
goroutine 1 [running]:
panic(0x414ee0, 0xc82000a0b0)
/usr/local/go/src/runtime/panic.go:481 +0x3e6
github.com/pkmngo-odi/pogo/api.(*Session).GetPlayerMap(0xc820012550, 0x1, 0x0, 0x0)
/Users/Moddy/go/src/github.com/pkmngo-odi/pogo/api/session.go:223 +0x47a
main.main()
/Users/Moddy/go/src/github.com/moddyz/pokemapgo/test.go:49 +0x59b
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.