juftin / camply

camply, the campsite finder ⛺️ - a tool to find campsites at sold out campgrounds through sites like recreation.gov
https://juftin.com/camply/
MIT License
464 stars 89 forks source link

GoingToCamp midnrreservations.com ConnectionError #309

Open wyatt-p opened 7 months ago

wyatt-p commented 7 months ago

Describe the bug

Seems to be a connection error when trying to use the GoingToCamp provider, and trying to search campsites using rec area 17 (midnrreservations.com). It does not list anything, just throws a connection error as summarized below.

Original Camply Command (with --debug)

camply --debug campgrounds --provider goingtocamp --rec-area 17        
camply --debug campgrounds --provider goingtocamp --rec-area 17        
[2024-01-06 09:41:00] CAMPLY   camply, the campsite finder ⛺️                                                                                                                                                      
[2024-01-06 09:41:00] DEBUG    Setting up camply debugging                                                                                                                                                         
[2024-01-06 09:41:00] DEBUG    Camply Version: 0.31.1                                                                                                                                                              
[2024-01-06 09:41:00] DEBUG    Python Version: 3.10.12                                                                                                                                                             
[2024-01-06 09:41:00] DEBUG    Platform: linux                                                                                                                                                                     
[2024-01-06 09:41:00] INFO     Using Camply Provider: "GoingToCamp"                                                                                                                                                
[2024-01-06 09:41:00] INFO     Retrieving Facility Information for Recreation Area ID: `17`.                                                                                                                       
[2024-01-06 09:41:00] DEBUG    Starting new HTTPS connection (1): midnrreservations.com:443                                                                                                                        
[2024-01-06 09:41:01] DEBUG    https://midnrreservations.com:443 "GET /api/resourceLocation HTTP/1.1" 403 None                                                                                                     
[2024-01-06 09:41:01] ERROR    Receiving bad data from GoingToCamp API: status_code: 403: <html><head><title>midnrreservations.com</title><style>#cmsg{animation: A 1.5s;}@keyframes                               
                               A{0%{opacity:0;}99%{opacity:0;}100%{opacity:1;}}</style></head><body style="margin:0"><p id="cmsg">Please enable JS and disable any ad blocker</p><script data-cfasync="false">var  
                               dd={'rt':'c','cid':'AHrlqAAAAAMAPvUZ_eJNvUAArRLrqQ==','hsh':'568CC9CF98AB4BEB49884E066FEF42','t':'bv','s':35226,'e':'d5a32a7a721a58f934c9bb75b3ae4e2d8b8f1f30e464ea01af713a2d5f22258
                               e','host':'geo.captcha-delivery.com'}</script><script data-cfasync="false" src="https://ct.captcha-delivery.com/c.js"></script></body></html> 

Expected behavior I would expect the appropriate rec areas to be listed for this site. I can replace the rec area ID with another valid one and it works as it should.

juftin commented 7 months ago

This looks like Captcha to me. If that's the case there's nothing we can do 😞 camply doesn't break Captcha, I would have to remove the RecArea entirely. I'll check closer soon.

juftin commented 7 months ago

Yeah, this looks a case of https://midnrreservations.com implementing captcha to keep tools like camply out of their data.

Here's a similar case where another GoingToCamp recreation area (https://reservations.ontarioparks.com) also implemented captcha: https://github.com/juftin/camply/issues/287

Most importantly, here is camply's policy on captcha:

Unfortunately, that type of feature [breaking captchas] will need to live on an unofficial fork outside of camply. If other providers implement captcha as well, they'll no longer be supported. Not only because of the user experience and maintenance burden, but because I have to respect their decision to keep bots out of their data.

Camply kind of skirts the edge on whether or not it is a tool that our providers approve of. Even though it's built in public, I have yet to hear from anyone asking me to take the package down or disconnect it from their website - so it seems like they at least tolerate it. Once we start breaking people's captchas (and the terms of service of captcha itself) that balance could shift and the future of camply for all providers might hang in the balance.

Unfortunately this means that we'll likely need to remove support for Michigan State Parks 😞

wyatt-p commented 7 months ago

OK, well I appreciate you guys taking a closer look!