ポケモンGOのAPIについて、少し調べたので残します。
自分用のメモなので間違っていたらごめんなさい。(コメントとか頂けると嬉しいです)
なお、URLの「reddit」を「れでぃっと」と記載しています。(Bad Requestのため)
1. APIについて
- APIは公開されていないので、リバースエンジニアリングしている人もいるようです
Guide to Pokemon Go Server ResponsesI’ll be updating this post as I figure more things outThings needed (incomplete list):
- A way to MITM/intercept responses (Charles with SSL Proxy via Wifi)
- ProtoBuf 3 (
protoc
on the command line)The second response
After the initial handshakes with
pgorelease.nianticlabs.com/plfe/rpc
you’ll get a response from the server that has three parts:
- Player
- Inventory
- Settings
In order to parse these, you’ll need to need to separate them - they each have overlapping messages, which makes it difficult to handle with one file.
If you’re looking at your .bin (binary file), look for the hex seq
a206020801
- this marks the end of the Player section, and you split the file after this seq. The next split is at the lasta206
- this marks the beginning of the Settings section, and you can make the split before this seq.Player
You can use this .proto file to decode your player binary with
protoc –decode Holoholo.Rpc.Player player.proto < player.bin
. There’s not a whole lot of information there yet.Inventory
You can use this .proto file to decode your inventory binary with
protoc –decode Holoholo.Rpc.Inventory inventory.proto < inventory.bin
. This has the most information of the response, detailing all of your items and pokemon.Settings
You can use this .proto file to decode your inventory binary with
protoc –decode Holoholo.Rpc.Final settings.proto < settings.bin
. This has the most information of the response, detailing all of your items and pokemon (sorry for the inconsistent naming).Map Response
After you’ve been talking to server a while, you’ll send up your lat/long at some point to request map cell information. The response can be decoded with this .proto file and
protoc –decode Holoholo.Rpc.Map map.proto < response.bin
. This is a pretty interesting response which includes nearby pokemon, wild pokemon, forts, spawn points, etc.Conclusion/comments
It’s interesting that the nearby pokemon return distances, and not points on the map. It should be reasonably easy to triangulate their position with three sets of data (assuming they don’t move - I don’t think they do). I’m not sure if their EncounterId is unique (doesn’t decode correctly right now), which might make it difficult to sort to triangulate.
Once the pokemon are close enough to you, it looks like a MapPokemon/WildPokemon gets returned, at which point you can see their exact point on the map, along with their expiration time and spawn id - I’m not sure why both Map and Wild are needed. Maybe it’s related to them being able to be captured/visible?
The settings provide some interest info (in case you’re unable to decode):
Settings { Sha1: “” Values { FortSettings { InteractionRangeMeters: 40 MaxTotalDeployedPokemon: 10 MaxPlayerDeployedPokemon: 1 DeployStaminaMultiplier: 2 FarInteractionRangeMeters: 1000 } MapSettings { PokemonVisibleRange: 100 PokeNavRangeMeters: 200 EncounterRangeMeters: 50 GetMapObjectsMinRefreshSeconds: 5 GetMapObjectsMaxRefreshSeconds: 30 GetMapObjectsMinDistanceMeters: 10 GoogleMapsApiKey: “” } InventorySettings { MaxPokemon: 1000 MaxBagItems: 1000 BasePokemon: 250 BaseBagItems: 350 BaseEggs: 9 } MinimumClientVersion: “0.29.0” } }
Some of these things were confirmed earlier, but it’s neat to see them as actual variables from the server, rather than hard-coded into the game.
Here’s a sample Inventory Pokemon (sorry for censoring - idk how unique these are):
Pokemon { PokemonId: 98 Cp: 19 Stamina: 29 MaxStamina: 29 Move1: 216 Move2: 20 HeightM: 0.42 WeightKg: 7. IndividualAttack: 14 IndividualDefense: 9 IndividualStamina: 13 CpMultiplier: 0.39 Pokeball: 2 CapturedS2CellId: CreationTimeMs: 1468154****** }
Here are some NearbyPokemon examples:
NearbyPokemon { PokedexNumber: 19 DistanceMeters: 107.49982 } NearbyPokemon { PokedexNumber: 46 DistanceMeters: 48.262047 } NearbyPokemon { PokedexNumber: 19 DistanceMeters: 105.36407 } NearbyPokemon { PokedexNumber: 10 DistanceMeters: 191.24013 }
There’s still quite a few requests to get through - if anyone is doing something similar, feel free to post them here, or ask questions.
Please don’t ask me how to set mitm/protobuf/other things up.
https://www.れでぃっと.com/r/pokemongodev/comments/4svl1o/guide_to_pokemon_go_server_responses/ より抜粋
2. 非公式サービスのポケモン情報の取得方法について
- 多数の非公式サービスは、「pokevision」や「catch that」などから無許可でAPIを利用しているよう(niantic -> pokevisionやcatch that -> 多数サービス)
pokevision
- サービス停止中(7月31日くらい〜)
↓FAQです。(nianticのapiを使っているらしいです)
Find all Pokemon near you (or a selected target location) in real time for Pokemon Go. Pokemon nearby will be marked along with their appearance timer on the map. These are real time Pokemon locations, meaning they are currently live and can be found exactly at the marked spots.
What is Pokevision?
Pokevision is a Pokemon tracker/locator for the mobile game Pokemon Go. It uses the Niantic API to grab the location of all Pokemon near your (or your selected location) and display them on the map in real-time; this means if it is displayed on the map, you can go out and catch them! Note: Rarer pokemons have a shorter appearance time so they might despawn; make sure to be quick and keep an eye on their timers!
How do I track Pokemon using Pokevision?
There are a few methods to scan for the location of Pokemon:
- Click anywhere on the map to drop a location marker. After placing a marker, press scan to reveal Pokemon nearby.
- Use the Search Bar to enter your location (or a location you wish to scan) and hit enter. You can then click Scan. If there are Pokemon nearby, they will display on the map along with their appearance time.
Are the Pokemon displayed actually there?
Yes - as long as the timer has not reached 0, the Pokemon are actually there and in real time.
How come I see some Pokemon in game but not on your map?
Pokemon that spawn due to lure/incense are not visible on our map since those pokemon are visible to only you.
Can I scan anywhere?
As long as it is an area where Pokemon Go is serviced, yes. Please keep in mind we have a small delay between scans so that requests do not spam the servers. Scans take around 5-15 seconds depending on the density of the area.
I am receiving an error. Help!
The Pokemon Go servers are very overloaded during peak hours of the day, this also affects the API and results may take longer or stall. Please be patient and try again!
What map provider are you using?
We are grateful to be provided map tiles and geocoding services by the folks over at Esri .
How do I contact you guys regarding suggestions, feedback, or business inquiries?
You may reach us via the contact us page.
https://pokevision.com/faqより抜粋
catch that(SkipLagged)
- 8月22日時点では利用出来ている(日本はサービス対象外?)
- SKIPLAGGEDのトラップストリート?をやっている
- メイン事業は、旅行関連のサービスっぽい
↓色々他社サービスにAPIを無断で利用されているようです。
Shame shame shameSo a while back, we built an api endpoint that instantly provides live positions of wild pokemon. It was meant for use by our services and personal use by anyone (who agrees not to abuse, of course).
Not surprisingly people have been abusing this, to the point where lots of websites and mobile apps are calling it directly.
As such, we figured trolling is only fair:
http://i.imgur.com/SJaUXpF.jpg
http://i.imgur.com/qU3RApd.jpg
http://i.imgur.com/zSHcLfH.jpg
http://i.imgur.com/WvcVNvL.jpg
http://i.imgur.com/LQgyzsa.png
http://i.imgur.com/cU54C4L.png
http://i.imgur.com/K3bigJ1.jpg
https://na.cx/i/T7K84g.png (thanks to /u/mlc130104, https://www.れでぃっと.com/r/pokemongodev/comments/4yheff/pokefast_isnt_the_only_api_sending_bogus_pokemon/
C'mon folks, servers are expensive. Especially when processing tens of thousands of searches per second..
Press:
http://did2memo.net/2016/08/19/pokemon-go-p-go-search-data-source-skiplagged/
https://www.れでぃっと.com/r/pokemongodev/comments/4yhpk0/shame_shame_shame/ より抜粋
その他