tejado / pgoapi

Pokemon Go API lib
Other
1.4k stars 447 forks source link

get_map_objects? #191

Open jangeja opened 7 years ago

jangeja commented 7 years ago

I just ran the spiral search demo and I didn't find any pokemon or pokestops and I know there were some in the area. I'm only seeing these two fields in the JSON response.

'current_timestamp_ms': 1470569750623, 's2_cell_id': 9290065149094264832

mviniciusleal commented 7 years ago

The same here...any solution?

crispmark commented 7 years ago

Having the same problem as well. All I want is the location of gyms and pokestops.

Vigerus commented 7 years ago

The default radius was the issue in my code, i used radius = 5 in get_cell_ids before instead of the default radius = 10 to get smaller group of pokestops. Unsure what was the old parameter unit but now it seems to be expressed in meters and values 300 - 1000 are getting the similar amount of pokestops as 5-10 before.

Commit hash: 35221ff5daf21f9c568c0f6b59d237ca6caeb30c

EDIT: I meant the one in utilities.py, spiral_poi_search.py uses its own method. Maybe it's better to reattach it to utilities.py

ProLoDs commented 7 years ago

the unkown6 fix has not been merged yet, see the pull requests

jangeja commented 7 years ago

Anyone figure this out? Modified spiral_poi_search.py so that it uses the utilities.py get_cell_ids, but im still running into the same issue

dnsBlah commented 7 years ago

@ProLoDs It might be just me, but even if I merge these files, the cells are still empty :( Can anyone shine a light here ?

jangeja commented 7 years ago

I've been banging my head on a wall with this problem. Am I missing something?

ProLoDs commented 7 years ago

https://github.com/weissi1994/PokemonGo-Map see this

jangeja commented 7 years ago

I'd like to use the pgoapi to build my own application. I will be doing a little more than just a pokemonGo Map. Why am I only getting empty cells?

dnsBlah commented 7 years ago

@ProLoDs indeed the ahaaaaa map is working again :) thats a great relief, but my debug engineering aint that level yet to see what I need to change exactly.

Just receiving empty cells, thought mayba a ban, but thats not the case, just guessing that somehow we need to implement the u6 proto together with all the requests i.e. get_mapobjects But thats already in the requests proto (i think) combining the get_mapobjects in the original call, and even after 10 seconds or whatever does not give any results on mapobjects

jangeja commented 7 years ago

@dnsBlah

  1. Download http://pastebin.com/raw/fCSw0Fz4 as encrypt.c
  2. Compile to .so (gcc -shared -o encrypt.so -fPIC encrypt.c)
  3. Edit ~/pgoapi-master/pgoapi/pygoapi.py insert this line in the init method of PGoApi: self.__signature_lib = "encrypt.so"
  4. Copy encrypt.so into same directory as the python program you are running OR include it in path
  5. DONE!!! IT WORKS!
dnsBlah commented 7 years ago

@jmangeja1 Been there, done that, still no results :( o wait, step 4... ? moment :)

jangeja commented 7 years ago

@dnsBlah self.__signature_lib = "encrypt.so" Is the most important step.

if you don't do step 4, you will get an error saying it cant find encrypt.so so thats easy to track down However it took a while to figure out setting the signature lib

jangeja commented 7 years ago

@dnsBlah Also I forgot to mention....

These should be run after 4 in my previous comment

  1. uninstall pygoapi (pip uninstall pygoapi)
  2. reinstall python setup.py install
dnsBlah commented 7 years ago

Actually I used the dll file

life saver!

Trolldemorted commented 7 years ago

@jmangeja1 thanks a lot! On my debian however putting encrypt.so into a directory in $PATH did not work, i had to use an absolute path instead.

BigChase commented 7 years ago

I am using https://github.com/keyphact repository as of evening of August 10th with encrypt.dll compiled on a mac and am not getting any objects returned in GET_MAP_OBJECTS calls. What is the fix?

jangeja commented 7 years ago

@BigChase if youre using a Mac, you need encrypt.so and you need to compile it yourself. Follow my instructions posted earlier

BigChase commented 7 years ago

@jmangeja1 I've done so.  Compiled both into encrypt.dll in /usr/local/lib and as encrypt.so in same directory as pgoapi.py.

How can I debut encrypt.dll in order to determine if it's functioning correctly? (There were a large number of warnings during compilation to encrypt.so, but just repeats of "warning: '&' within '|' [-Wbitwise-op-parentheses]".)

(On a Mac.)

jangeja commented 7 years ago

warnings are fine. Did you change the line about signature lib in pgoapi.py?

BigChase commented 7 years ago

Yes, changed that line though I am using keyphact's repository which was updated yesterday and again today which I believe deals with signature issues in slightly different way. With the folllowing line in pokecli.py:

api.activate_signature("/usr/local/lib/encrypt.dll")

plus i added encrypt.dll to global path.

jangeja commented 7 years ago

try app.activate_signature("encrypt.so") and put encrypt.so in the same directory as pokecli.py

BigChase commented 7 years ago

Great idea! And guess what? Worked like a charm! Love you man. Was working on this non-stop for 24 hours straight trying every combination of repository, user account, etc.

Until I followed your advice, I was using the compilation instructions and file placement on the following URL: https://github.com/tejado/pgoapi/issues/181#issuecomment-238058983. Wonder why it didn't work and your approach did?

The next issue I am having is that I have to run pokecli.py twice everytime. The first time always yields: "pgoapi.exceptions.ServerSideRequestThrottlingException: Request throttled by server... slow down man". And then immediately rerunning script works to completion. Any ideas?

Thanks again. Huge help!

jangeja commented 7 years ago

Yea, You need to put time.sleep(x) delays after get_map_objects i recommend 10 seconds

BigChase commented 7 years ago

There is only one get_map_objects in pokecli.py, yet I still experience the described "slow doan man" failure on the first script execution. Can't figure out why?

jangeja commented 7 years ago

put a time.sleep(1) after any api call made in pokecli.py

BigChase commented 7 years ago

Thanks again. Now to start understanding the get_map_objects responses.... (size of a cell, how to reference the spawn times and exact locations of nearby pokemon, etc.)...

EasonPai commented 7 years ago

@dnsBlah
can you share your .dll? I have no idea how to build it on windows, thanks~

dnsBlah commented 7 years ago

I'm using a Unix machine, sorry. My dll would be useless. Try this one instead: #181 it's in a comment of Scotty

jangeja commented 7 years ago

@dnsblah how are you using a proxy? When I use a proxy it doesn't return and forts or Pokemon

EasonPai commented 7 years ago

@dnsblah I found it here, its working and i am getting a lot data of get_map_objects now, thanks bro

dnsBlah commented 7 years ago

ow nice!

Jacopo1891 commented 7 years ago

On Ubuntu 16.04, with last update. I still have this problem. Following https://github.com/tejado/pgoapi/issues/191#issuecomment-238098981 i do not solved. Trying with app.activate_signature("encrypt.so") still not work:

Traceback (most recent call last): File "spiral_poi_search.py", line 235, in main() File "spiral_poi_search.py", line 147, in main api.activate_signature("/usr/local/lib/encrypt.dll") File "/usr/local/lib/python2.7/dist-packages/pgoapi-1.1.6-py2.7.egg/pgoapi/pgoapi.py", line 90, in getattr raise AttributeError AttributeError

Any solution?

ajvish91 commented 7 years ago

I am getting empty cells as well. Even after different combinations of radius, GPS coords and delay. Here is roughly how the output looks like: [{'current_timestamp_ms': 1478832280274L, 's2_cell_id': 3592211176005566464L}, {'current_timestamp_ms': 1478832280274L, 's2_cell_id': 3592211154530729984L}, {'current_timestamp_ms': 1478832280274L, 's2_cell_id': 3592211156678213632L}, {'current_timestamp_ms': 1478832280274L, 's2_cell_id': 3592211167415631872L}, {'current_timestamp_ms': 1478832280274L, 's2_cell_id': 3592211169563115520L}, {'current_timestamp_ms': 1478832280274L, 's2_cell_id': 3592211171710599168L}, {'current_timestamp_ms': 1478832280274L, 's2_cell_id': 3592211173858082816L}, {'current_timestamp_ms': 1478832280274L, 's2_cell_id': 3592211158825697280L}, {'current_timestamp_ms': 1478832280274L, 's2_cell_id': 3592211160973180928L}, {'current_timestamp_ms': 1478832280274L, 's2_cell_id': 3592211163120664576L}, {'current_timestamp_ms': 1478832280274L, 's2_cell_id': 3592211165268148224L}] `

Why am I not able to get a single wild pokemon??