banool/recreation-gov-campsite-checker

Does this work for NPS permits, i.e. not just campgrounds?

Opened this issue · 2 comments

I'm wondering if this works for backcountry permits available via Rec.gov?

For example:
https://www.recreation.gov/permits/4675316

I believe not, but that's something I'd be interested in adding one day. I'm very open to PRs adding such functionality.

I took a look at what it'd take to implement this. It's tricky because different permits use different availability endpoints with different parameters, and also return different response formats. Some endpoint examples:

I found these 4 endpoints by checking ~10 random permit pages. Not sure how many more endpoints exist. I confirmed that not all endpoints support all permit IDs - eg the permits endpoint 404s when you pass in the Mt Whitney or Bryce permit IDs.

I don't see a clean way of querying what endpoint is used for a given permit ID. You could probably extract it by loading the full permit page and parsing the Javascript (ugh), but that still wouldn't tell you how to parse the response.

Two possible paths forward, neither very appealing:

  • Write a requester and a response parser for each of the N different endpoints, and try all of them sequentially for a given permit ID until one succeeds
  • Instead of asking users for a permit ID, require them to provide a config file containing the endpoint to use and the response keys