jekirl/poketrainer

autosnipe regex

skydrome opened this issue · 0 comments

edit: author made this feed private now (csfr is blocked)

alternatives:

https://pokewatchers.com/api.html
http://pokesniper.org/api.php
http://pokesnipers.com/api/v1/pokemon.json
http://pokeapi.pokesnipe.de/

too lazy to make a pull request for a 1 line change
the regex needs to be changed for some special cases, some entries are including names and spaces

"GET /2603/snipe/48.863017,2.290196Charmander HTTP/1.1" 200 -
"GET /2603/snipe/40.761103,-73.978824Dratini HTTP/1.1" 200 -
"GET /2603/snipe/-33.892353,%20151.240527 HTTP/1.1" 200 -

make it strip everything but digits and the comma ^0-9.,-
for stripping %20 can use decodeURI() this seems to be very rare only seen it once as above

this does the trick web/templates/status.html
fetch("{{url_for('snipe', username = username, latlng = '')}}" + decodeURI(latlng.replace(/[^0-9.,-]/g, "")), {mode: 'no-cors'});

ive also seen some strings like this which would still not work, thankfully not very many

"GET /2603/snipe/34.042449, -118.237267 IV:- HTTP/1.1" 200 -