An open API service indexing awesome lists of open source software.

https://github.com/dreamiurg/peakbagger-cli

Search, explore, and analyze mountain peak data from PeakBagger.com in your terminal
https://github.com/dreamiurg/peakbagger-cli

cli climbing hiking mountains peakbagging python statistics

Last synced: about 18 hours ago
JSON representation

Search, explore, and analyze mountain peak data from PeakBagger.com in your terminal

Awesome Lists containing this project

README

          

# peakbagger-cli

[![PyPI](https://img.shields.io/pypi/v/peakbagger.svg)](https://pypi.org/project/peakbagger/)

A command-line interface for searching and retrieving mountain peak data from [PeakBagger.com](https://www.peakbagger.com).

> **Other projects you might like:** [PNW Climb Planner](https://dreamiurg.net/pnw-climb-planner.html) ยท [mountaineers-mcp](https://github.com/dreamiurg/mountaineers-mcp) ยท [mountaineers-assistant](https://github.com/dreamiurg/mountaineers-assistant) ยท [claude-mountaineering-skills](https://github.com/dreamiurg/claude-mountaineering-skills)

Buy Me a Coffee at ko-fi.com

## Features

- ๐Ÿ” **Search peaks** by name with instant results
- ๐Ÿ“Š **Detailed peak info** including elevation, prominence, isolation, and location
- ๐Ÿ“ˆ **Ascent statistics** - analyze climbing activity, seasonal patterns, and trip reports
- ๐ŸŽจ **Beautiful output** with formatted tables and colors
- ๐Ÿค– **JSON output** for automation and scripting
- ๐Ÿ›ก๏ธ **Respectful scraping** with configurable rate limiting

> **For contributors**: See [CONTRIBUTING.md](CONTRIBUTING.md) for development setup and guidelines.

## Installation

### Using uvx (Recommended)

Run directly without installation:

```bash
uvx peakbagger peak search "Mount Rainier"
uvx peakbagger peak show 2296
```

### From PyPI

```bash
pip install peakbagger
```

### Cloudflare bypass (optional)

PeakBagger.com sits behind a Cloudflare challenge that the default HTTP client
cannot always pass. If you hit a `403`, install the `browser` extra, which adds a
stealth-browser fallback (it briefly opens a real Chrome window to clear the
challenge, then caches the result):

```bash
pip install 'peakbagger[browser]' # requires Google Chrome installed
```

## Usage

### Search for peaks

```bash
peakbagger peak search "Mount Rainier"
peakbagger peak search "Denali" --format json
peakbagger peak search "Whitney" --full # Fetch full details for all results
```

### Get peak details

```bash
peakbagger peak show 2296 # Mount Rainier
peakbagger peak show 2296 --format json
```

Output includes elevation, prominence, coordinates, routes, and peak lists.

### List peak ascents

```bash
peakbagger peak ascents 1798 # Mount Pilchuck
peakbagger peak ascents 1798 --within 1y # Last year only
peakbagger peak ascents 1798 --with-gpx # Only ascents with GPS tracks
peakbagger peak ascents 1798 --with-tr # Only with trip reports
peakbagger peak ascents 1798 --limit 50 # First 50 ascents
```

Filters: `--after DATE`, `--before DATE`, `--within PERIOD` (e.g., `3m`, `1y`, `10d`)

### Analyze ascent statistics

```bash
peakbagger peak stats 1798
peakbagger peak stats 1798 --within 5y
peakbagger peak stats 1798 --reference-date 2024-07-15 --seasonal-window 30
```

Shows temporal breakdown, seasonal patterns, and monthly distribution.

### Get ascent details

```bash
peakbagger ascent show 12963
peakbagger ascent show 12963 --format json
```

Includes trip reports and route information.

### Get trip reports for a peak

```bash
peakbagger trip-reports 1798 # Mount Pilchuck
peakbagger trip-reports 1798 --limit 5 --min-words 100
peakbagger trip-reports 1798 --within 1y --format json
```

Filters: `--after DATE`, `--before DATE`, `--within PERIOD` (e.g., `3m`, `1y`, `10d`)

## Examples

### Automation with jq

```bash
# Extract specific fields
peakbagger peak show 2296 --format json | jq '.elevation.feet'
peakbagger peak search "Rainier" --format json | jq '.[].pid'
peakbagger trip-reports 1798 --format json | jq '.[].text'

# Find peaks on a specific list
peakbagger peak show 2296 --format json | jq '.peak_lists[] | select(.list_name | contains("Bulger"))'
```

### Batch processing

```bash
for pid in 2296 271 163756; do
peakbagger peak show $pid --format json >> peaks.json
done
```

**More examples**: See [`examples/`](examples/) for complete scripts including CSV export and filtering.

## Configuration

### Logging

```bash
# Show HTTP requests
peakbagger --verbose peak search "Mount Rainier"
peakbagger -v peak show 2296

# Show detailed debug info
peakbagger --debug peak search "Mount Rainier"

# Suppress all output except data
peakbagger --quiet peak search "Mount Rainier"
peakbagger -q peak show 2296
```

Logs go to stderr, so you can redirect separately:

```bash
# Save JSON output, show logs on screen
peakbagger -v peak show 2296 --format json > peak.json

# Save output and logs separately
peakbagger -v peak show 2296 --format json > peak.json 2> logs.txt
```

### Rate Limiting

Default: 2 seconds between requests. Adjust as needed:

```bash
peakbagger peak search "Rainier" --rate-limit 3.0 # 3 seconds
```

## Ethical Use

Use this tool for **personal and educational purposes** only. Please:

- โœ… Respect the default rate limits (or increase them)
- โœ… Use for personal research and trip planning
- โœ… Attribute data to PeakBagger.com
- โŒ Don't mass-scrape or create bulk datasets
- โŒ Don't use for commercial purposes without permission
- โŒ Don't bypass rate limits to hammer the server

PeakBagger.com provides this data as a free service to the climbing community. Use this tool responsibly.

## Troubleshooting

**Cloudflare blocks** (`403`): Install the stealth-browser fallback with
`pip install 'peakbagger[browser]'` (requires Google Chrome). On the next `403`
it opens a real Chrome window once to clear the challenge and caches the result.

**No results**: Try different search terms or verify the peak ID is correct.

**Installation issues**: Requires Python 3.12+ (`python3 --version`).

## Data Source

All data is scraped from [PeakBagger.com](https://www.peakbagger.com). The site aggregates peak information from USGS,
LIDAR data, and user contributions.

**Limitations**: No official API (scrapes HTML), rate-limited for respectful use, data accuracy depends on
PeakBagger.com.

## Support

- **Bug Reports & Features**: [GitHub Issues](https://github.com/dreamiurg/peakbagger-cli/issues)
- **Questions**: [GitHub Discussions](https://github.com/dreamiurg/peakbagger-cli/discussions)

## License

MIT License - see [LICENSE](LICENSE) file for details.

---

## More from @dreamiurg

- ๐Ÿ”๏ธ **[PNW Climb Planner](https://dreamiurg.net/pnw-climb-planner.html)** โ€” pick a Washington peak, see the odds of a climbable day from 20 years of weather data, and line up backups ([the story behind it](https://dreamiurg.net/2026/07/01/picking-backup-climbs.html))
- **[mountaineers-mcp](https://github.com/dreamiurg/mountaineers-mcp)** โ€” mountaineers.org for AI assistants: activities, courses, routes, trip reports
- **[mountaineers-assistant](https://github.com/dreamiurg/mountaineers-assistant)** โ€” Chrome extension with your Mountaineers climbing stats, local-only
- **[claude-mountaineering-skills](https://github.com/dreamiurg/claude-mountaineering-skills)** โ€” automated route research: weather, hazards, and trip reports in one report
- more at [dreamiurg.net/projects](https://dreamiurg.net/projects/)

Made by [@dreamiurg](https://dreamiurg.net) in Seattle. If this project saved you time, you can [buy me a coffee](https://ko-fi.com/Q3N622FHZM) โ€” appreciated, never expected.