steve8x8 / geotoad

Geocaching query tool written in Ruby
https://buymeacoffee.com/steve8x8
Other
28 stars 8 forks source link

Location query fails #375

Open VsQ90 opened 1 week ago

VsQ90 commented 1 week ago

Whether using TUI or straight command, location search fails with Unknown response error. I've checked that location works and it should be found. Coordinate search works fine.

Command used: geotoad.rb -L 1 -O -v "times square"

Verbose output:

(===) GeoToad 3.34.1 (Ruby 3.1.5p252/2024-04-23 on x86_64-linux)
( - ) See   https://github.com/steve8x8/geotoad.git   for latest changes and bug reports!
( - ) Using TLSv1_2 and SSL verification.
( o ) Using command line settings:
( - ) geotoad.rb --limitSearchPages=1 'times square'
I: geotoad.rb --limitSearchPages=1 'times square'
( - ) Setting debug level to 1
D0: Debug level set to 1
D1: Internally using distance 10 miles.
D1: Limiting search to 1 pages
( - ) Thank you for using a released or patched version of GeoToad.
( - ) Report bugs or suggestions at https://github.com/steve8x8/geotoad/
( - ) Please include verbose output (-v) without passwords in the bug report.
-------------------------------------------------------------------------------
( o ) Templates: /home/vesku/Lataukset/geotoad-3.34.1/lib/../templates
( - )     62 templates total
( o ) Dictionary: /home/vesku/.config/GeoToad/mapping.yaml
( - )     94 WID->GUID mappings total
-------------------------------------------------------------------------------
( - ) Cache directory: /home/vesku/.config/GeoToad/cache
( o ) Logging in as -VsQ-
D1: login called for user=-VsQ- pass=*********
D1: Fetching URL [https://www.geocaching.com/account/signin]
D1: Fetching URL [https://www.geocaching.com/account/signin]
D1: REDIRECT: [/play/search]
D1: Fetching URL [https://www.geocaching.com:443/play/search]
D1: Cookie __RequestVerificationToken=X9MwK[82]pipM1; gspkauth=hzLXY[162]Vd4Y1 looks good, rock on.
D1: Login returned cookie "__RequestVerificationToken=X9MwK[82]pipM1; gspkauth=hzLXY[162]Vd4Y1"
( o ) Login successful
( o ) Querying user preferences
D1: local cache is only 3268 (<= 43200) sec old, using local file.
D1: setting selected option SelectedCultureCode=en-US (English)
D1: setting selected option SelectedTimeZone=29 ((UTC+02:00) Helsinki, Kyiv, Riga, Sofia, Tallinn, Vilnius)
D1: setting selected option SelectedDateFormat=dd/MM/yyyy (30/06/2024)
D1: setting selected option SelectedGPXVersion=1.0.1 (1.0.1)
D1: location nil nil from unknown source
( - ) Using date format "dd/MM/yyyy", language "en-US"
 ***  There may be problems for some date format settings.
 ***  Using ISO date format (yyyy-MM-dd) is strongly recommended.
( - ) Using home location (nil, nil) from unknown source
-------------------------------------------------------------------------------
( o ) "location" search for "times square", constraining to 10 miles
D1: geocode looking up address "times square"
D1: no local cache file found for /home/vesku/.config/GeoToad/cache/nominatim.openstreetmap.org/search_q_times_square
D1: sleeping 5 seconds before remote fetch
D1: Fetching URL [https://nominatim.openstreetmap.org/search?q=times%20square&format=json&limit=1&addressdetails=0&polygon_svg=0]
 ***  Unknown response "#<Net::HTTPForbidden 403 Forbidden readbody=true>" [https://nominatim.openstreetmap.org/search?q=times%20square&format=json&limit=1&addressdetails=0&polygon_svg=0]
D1: 1 download errors so far, will try until 5
D1: Fetching URL [https://nominatim.openstreetmap.org/search?q=times%20square&format=json&limit=1&addressdetails=0&polygon_svg=0]
 ***  Unknown response "#<Net::HTTPForbidden 403 Forbidden readbody=true>" [https://nominatim.openstreetmap.org/search?q=times%20square&format=json&limit=1&addressdetails=0&polygon_svg=0]
D1: 2 download errors so far, will try until 5
D1: Fetching URL [https://nominatim.openstreetmap.org/search?q=times%20square&format=json&limit=1&addressdetails=0&polygon_svg=0]
 ***  Unknown response "#<Net::HTTPForbidden 403 Forbidden readbody=true>" [https://nominatim.openstreetmap.org/search?q=times%20square&format=json&limit=1&addressdetails=0&polygon_svg=0]
D1: 3 download errors so far, will try until 5
D1: Fetching URL [https://nominatim.openstreetmap.org/search?q=times%20square&format=json&limit=1&addressdetails=0&polygon_svg=0]
 ***  Unknown response "#<Net::HTTPForbidden 403 Forbidden readbody=true>" [https://nominatim.openstreetmap.org/search?q=times%20square&format=json&limit=1&addressdetails=0&polygon_svg=0]
D1: 4 download errors so far, will try until 5
D1: Fetching URL [https://nominatim.openstreetmap.org/search?q=times%20square&format=json&limit=1&addressdetails=0&polygon_svg=0]
 ***  Unknown response "#<Net::HTTPForbidden 403 Forbidden readbody=true>" [https://nominatim.openstreetmap.org/search?q=times%20square&format=json&limit=1&addressdetails=0&polygon_svg=0]
D1: 5 download errors so far, maximum reached
D1: Fetching URL [https://nominatim.openstreetmap.org/search?q=times%20square&format=json&limit=1&addressdetails=0&polygon_svg=0]
 ***  Unknown response "#<Net::HTTPForbidden 403 Forbidden readbody=true>" [https://nominatim.openstreetmap.org/search?q=times%20square&format=json&limit=1&addressdetails=0&polygon_svg=0]
( - ) Offline mode: not fetching https://nominatim.openstreetmap.org/search?q=times%20square&format=json&limit=1&addressdetails=0&polygon_svg=0
 ***  File pattern "boundingbox": not found in data (0b)
( o ) OpenStreetMap Nominatim search for times square returned
 ***   no results.
D1: returning: [nil, nil, nil, "", 0]
D1: geocoder returned: a:nil x: y:
 ***  GeoCoder failed to determine the location of times square
 ***  Search "location" for "times square" unknown.
 ***  Check for special characters or try a "coord" search instead.
D1: waypoints extracted: 0, combined: 0
 ***  No valid query or no caches found in search, exiting early.
steve8x8 commented 3 days ago

Oh yes ;) Nominatim again. Will have to look deeper into this. Stay tuned.

steve8x8 commented 3 days ago
Access blocked

You have been blocked because you have violated the
usage policy
of OSM's Nominatim geocoding service. Please be aware that OSM's resources are
limited and shared between many users. The usage policy is there to ensure that
the service remains usable for everybody.

Please review the terms and make sure that your
software adheres to the terms. You should in particular verify that you have set a
custom HTTP referrer or HTTP user agent that identifies your application, and
that you are not overusing the service with massive bulk requests.

If you feel that this block is unjustified or remains after you have adopted
your usage, you may contact the Nominatim system administrator at
nominatim@openstreetmap.org to have this block lifted.

😿

steve8x8 commented 2 days ago

Although I've experimented with various HTTP header settings, and succeed querying using a browser (firefox, or even lynx -source), I cannot get this to work. The only workaround currently is to do the query manually, and use the coordinates obtained. Help is welcome.

steve8x8 commented 2 days ago

Some additional information. Firefox gets this response:

HTTP/2 200 
server: nginx
date: Fri, 05 Jul 2024 11:02:13 GMT
content-type: application/json; charset=utf-8
content-length: 511
X-Firefox-Spdy: h2

while lynx -source -head is answered with

HTTP/1.1 405 Method Not Allowed
Server: nginx
Date: Fri, 05 Jul 2024 13:41:28 GMT
Content-Type: application/json
Content-Length: 35
Connection: close
allow: GET, OPTIONS
vary: Accept

although

$ lynx -source "https://nominatim.openstreetmap.org/search?q=times%20square&format=json&limit=1"
[{"place_id":311840046,"licence":"Data © OpenStreetMap contributors, ODbL 1.0. http://osm.org/copyright","osm_type":"way","osm_id":702540318,"lat":"40.757261400000004","lon":"-73.98589982948505","class":"place","type":"square","place_rank":25,"importance":0.5439494846055839,"addresstype":"square","name":"Times Square","display_name":"Times Square, Manhattan Community Board 5, Manhattan, New York County, New York, 10036, United States","boundingbox":["40.7564751","40.7580455","-73.9866378","-73.9853729"]}]

I just can't get the knack of it :(

steve8x8 commented 2 days ago

It seems I forgot to reference this issue in my last commit. I got addresses working again (tested with "buckingham palace"), but don't know exactly yet why... I need more coffee, it seems ;)