{"id":21374813,"url":"https://github.com/banool/recreation-gov-campsite-checker","last_synced_at":"2025-04-04T14:10:08.245Z","repository":{"id":37561625,"uuid":"140966466","full_name":"banool/recreation-gov-campsite-checker","owner":"banool","description":"Scrapes the recreation.gov website to check for campsite availabilities 🏕🏕","archived":false,"fork":false,"pushed_at":"2024-08-18T15:36:09.000Z","size":53,"stargazers_count":337,"open_issues_count":8,"forks_count":167,"subscribers_count":30,"default_branch":"master","last_synced_at":"2025-03-28T13:11:11.056Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":"","language":"Python","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"apache-2.0","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/banool.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE.md","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2018-07-14T17:50:03.000Z","updated_at":"2025-03-21T15:02:29.000Z","dependencies_parsed_at":"2024-08-18T17:13:35.489Z","dependency_job_id":null,"html_url":"https://github.com/banool/recreation-gov-campsite-checker","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/banool%2Frecreation-gov-campsite-checker","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/banool%2Frecreation-gov-campsite-checker/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/banool%2Frecreation-gov-campsite-checker/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/banool%2Frecreation-gov-campsite-checker/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/banool","download_url":"https://codeload.github.com/banool/recreation-gov-campsite-checker/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":247190255,"owners_count":20898702,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":[],"created_at":"2024-11-22T08:45:31.249Z","updated_at":"2025-04-04T14:10:08.224Z","avatar_url":"https://github.com/banool.png","language":"Python","funding_links":[],"categories":[],"sub_categories":[],"readme":"# Campsite Availability Scraping\n\n**This has been updated to work with the new recreation.gov site and API!!!**\n\nThis script scrapes the https://recreation.gov website for campsite availabilities.\n\n**Note:** Please don't abuse this script. Most folks out there don't know how to run scrapers against websites, so you're at an unfair advantage by using this.\n\n## Example Usage\n```\n$ python camping.py --start-date 2018-07-20 --end-date 2018-07-23 --parks 232448 232450 232447 232770\n❌ TUOLUMNE MEADOWS: 0 site(s) available out of 148 site(s)\n🏕 LOWER PINES: 11 site(s) available out of 73 site(s)\n❌ UPPER PINES: 0 site(s) available out of 235 site(s)\n❌ BASIN MONTANA CAMPGROUND: 0 site(s) available out of 30 site(s)\n```\n\nYou can also read from stdin. Define a file (e.g. `parks.txt`) with park IDs like this:\n```\n232447\n232449\n232450\n232448\n```\nand then use it like this:\n```\n$ python camping.py --start-date 2018-07-20 --end-date 2018-07-23 --stdin \u003c parks.txt\n```\nFor powershell, try this:\n```\nPS \u003e Get-Content parks.txt | python camping.py --start-date 2021-09-24 --end-date 2022-09-24 --stdin\n```\n\nIf you want to see more information about which campsites are available, pass `--show-campsite-info` along with `--nights \u003cint\u003e`:\n```\n$ python camping.py --start-date 2018-07-20 --end-date 2018-07-23 --parks 232448 232450 232447 232770 --show-campsite-info --nights 1 \nThere are campsites available from 2018-07-20 to 2018-07-23!!!\n🏕 ELK CREEK CAMPGROUND (SAWTOOTH NF) (232042): 1 site(s) available out of 1 site(s)\n  * Site 69800 is available on the following dates:\n    * 2018-07-20 -\u003e 2018-07-21 \n    * 2018-07-21 -\u003e 2018-07-22\n```\n\nIf you only want results for certain campsite IDs, pass `--campsite-ids \u003cint\u003e`:\n```bash\n$ python camping.py --start-date 2018-07-20 --end-date 2018-07-23 --parks 232431 --show-campsite-info --nights 1 --campsite-ids 18621 \n```\n\nYou'll want to put this script into a 5 minute crontab. You could also grep the output for the success emoji (🏕) and then do something in response, like notify you that there is a campsite available. See the \"Twitter Notification\" section below.\n\n## Number of nights\nIf you're flexible on travel dates, you can search for a specific number of contiguous nights within a wide range of dates. This is useful for campgrounds in high-demand areas (like Yosemite Valley) or during peak season when openings are rare. Simply specify the `--nights` argument. For example, to search for a 5-day reservation in the month of June 2020 at Chisos Basin:\n```\n$ python camping.py --start-date 2020-06-01 --end-date 2020-06-30 --nights 5 234038\nThere are campsites available from 2020-06-01 to 2020-06-30!!!\n🏕 CHISOS BASIN (BIG BEND) (234038): 13 site(s) available out of 62 site(s)\n```\n\n## Getting park IDs\nWhat you'll want to do is go to https://recreation.gov and search for the campground you want. Click on it in the search sidebar. This should take you to a page for that campground, the URL will look like `https://www.recreation.gov/camping/campgrounds/\u003cnumber\u003e`. That number is the park ID.\n\n## Getting campsite IDs\nGo to https://recreation.gov and first search for the campground you want and then select the specific campsite within that campground. The URL for the campsite should look like `https://www.recreation.gov/camping/campsites/\u003cnumber\u003e`. That number is the campsite ID.\n\n## Searching for availability at a specific campsite within a campground\nYou can search for availability at just a single specific campsite using the '--campsite-ids' argument. This can be useful if you have a favorite campsite you like to use or if you have a reservation at a specific campsite that you want to add days to before or after your existing reservation. This search only works for one campground/campsite combination at a time.\n```\n$ python camping.py --start-date 2020-06-01 --end-date 2020-06-30 --nights 5 --parks 234038 --campsite-ids 6943\nThere are campsites available from 2020-06-01 to 2020-06-30!!!\n🏕 CHISOS BASIN (BIG BEND) (234038): 1 site(s) available out of 62 site(s)\n```\n\nYou can also take [this site for a spin](https://pastudan.github.io/national-parks/). Thanks to [pastudan](https://github.com/pastudan)!\n\n## Excluding specific campsites\n\nYou can exclude specific campsites, for example group sites, by defining a file (e.g. `excluded.txt`) with one campsite ID per line and using the `--exclusion-file` argument like this:\n\n```\n$ python camping.py --start-date 2018-07-20 --end-date 2018-07-23 --parks 232448 232450 232447 232770 --exclusion-file excluded.txt\n```\n\n## Installation\n\nI wrote this in Python 3.7 but I've tested it as working with 3.5 and 3.6 also.\nIt is best to use 3.9+\n```\npython3 -m venv myvenv\nsource myvenv/bin/activate\npip install --upgrade pip\npip install -r requirements.txt\n# You're good to go!\n```\n\n## Development\nThis code is formatted using black and isort:\n```\nblack -l 80 --py36 camping.py\nisort camping.py\n```\nNote: `black` only really supports 3.6+ so watch out!\n\nFeel free to submit pull requests, or look at the original: https://github.com/bri-bri/yosemite-camping\n\n### Running Tests\n\nAll tests should pass before a pull request gets merged. To run all the tests, cd into the project directory and run:\n```bash\npython -m unittest\n``` \n\n### Differences from the original\n- Python 3 🐍🐍🐍.\n- Park IDs not hardcoded, passed via the CLI instead.\n- Doesn't give you URLs for campsites with availabilities.\n- Works with any park out of the box, not just those in Yosemite like with the original.\n- **Update 2018-10-21:** Works with the new recreation.gov site.\n\n## Twitter Notification\nIf you want to be notified about campsite availabilities via Twitter (they're the only API out there that is actually easy to use), you can do this:\n1. Make an app via Twitter. It's pretty easy, go to: https://developer.twitter.com/en/apps.\n2. Change the values in `twitter_credentials.json` to match your key values.\n3. Pipe the output of your command into `notifier.py`. See below for an example.\n\n```\npython camping.py --start-date 2018-07-20 --end-date 2018-07-23 --parks 70926 70928 | python notifier.py @banool1\n```\n\nYou'll want to make the app on another account (like a bot account), not your own, so you get notified when the tweet goes out.\n\nI left my API keys in here but don't exploit them ty thanks.\n\n**Thanks to https://github.com/bri-bri/yosemite-camping for getting me most of the way there for the old version.**\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fbanool%2Frecreation-gov-campsite-checker","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fbanool%2Frecreation-gov-campsite-checker","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fbanool%2Frecreation-gov-campsite-checker/lists"}