fedco-trees

Crates.iofedco-trees
lib.rsfedco-trees
version0.1.0
created_at2025-11-18 02:43:37.672051+00
updated_at2025-11-18 02:43:37.672051+00
descriptionCLI tool for scraping and searching the Fedco Seeds tree catalog
homepage
repositoryhttps://github.com/alexjokela/fedco-trees
max_upload_size
id1937807
size120,850
Alex Jokela (ajokela)

documentation

README

Fedco Trees CLI

A command-line tool for scraping and searching the Fedco Seeds tree catalog with advanced filtering capabilities.

Features

  • Web Scraping: Automatically crawl fedcoseeds.com/trees to collect comprehensive tree data
  • Rich Data: Captures variety names, USDA zones, rootstock options with item codes, pricing, descriptions, and more
  • Interactive TUI: Browse trees with a beautiful terminal user interface with real-time filtering
  • Powerful Filtering: Filter by USDA zone, tree size (dwarf/semi-dwarf/standard), category, season, price
  • Fast Search: Full-text search across names, descriptions, and characteristics
  • Export/Import: Save data as JSON for offline browsing
  • Item Codes: Extracts ordering codes for each rootstock option (e.g., 7204-A, 7204-C)

Installation

Prerequisites

  • Rust 1.70 or later
  • Cargo (comes with Rust)

Build from Source

cd fedco-trees
cargo build --release

The binary will be at target/release/fedco-trees

Usage

Scraping Tree Data

Scrape all default categories (apples, pears, cherries, plums, peaches, apricots):

./target/release/fedco-trees scrape

Scrape specific categories:

./target/release/fedco-trees scrape --categories apples,pears
./target/release/fedco-trees scrape --categories cherries

Save to a custom file:

./target/release/fedco-trees scrape --output my-trees.json

Interactive TUI Browser

Browse trees interactively with keyboard navigation and real-time filtering:

./target/release/fedco-trees browse

Or browse a custom data file:

./target/release/fedco-trees browse --input my-trees.json

Keyboard Controls:

  • / or j/k: Navigate tree list
  • z: Filter by USDA hardiness zone
  • s: Filter by rootstock size (dwarf/semi-dwarf/standard)
  • c: Filter by category (apples, pears, etc.)
  • /: Search by keyword (searches names, descriptions, and characteristics)
  • r: Reset all filters
  • q or Ctrl+C: Quit

TUI Display:

  • Header: Shows active filters with color highlighting (zone, size, category, search)
  • Tree List (left panel): Scrollable list with zone and price for each variety
  • Details Panel (right panel): Full information about the selected tree including:
    • Product ID (in yellow)
    • Category, zone, season
    • Full description
    • Scientific name and origin
    • Characteristics (disease resistance, bearing patterns, etc.)
    • Rootstock options with item codes (in cyan)
  • Footer: Keyboard shortcuts reference or input prompt
  • Live Count: Shows filtered count vs total (e.g., "Trees (15/147)" when filtered)

Searching and Filtering

Search all trees:

./target/release/fedco-trees search

Filter by USDA hardiness zone (case-insensitive):

./target/release/fedco-trees search --zone Z3
./target/release/fedco-trees search --zone z4

Filter by tree size:

./target/release/fedco-trees search --size dwarf
./target/release/fedco-trees search --size semi-dwarf
./target/release/fedco-trees search --size standard

Filter by category:

./target/release/fedco-trees search --category apples
./target/release/fedco-trees search --category pears

Filter by harvest season:

./target/release/fedco-trees search --season summer
./target/release/fedco-trees search --season fall
./target/release/fedco-trees search --season winter

Filter by maximum price:

./target/release/fedco-trees search --max-price 35.00

Full-text search (case-insensitive):

./target/release/fedco-trees search --query "scab resistant"
./target/release/fedco-trees search --query "cider"
./target/release/fedco-trees search --query "Ashmead"

Combine multiple filters:

./target/release/fedco-trees search --zone Z4 --size semi-dwarf --category apples --max-price 40.00
./target/release/fedco-trees search --query "disease resistant" --zone z3 --season fall

Show detailed information:

./target/release/fedco-trees search --zone Z3 --detailed
./target/release/fedco-trees search --query "Cox" --detailed

Use a custom data file:

./target/release/fedco-trees search --input my-trees.json --zone Z4

Data Structure

The tool collects the following information for each tree:

  • Name: Variety name
  • Category: Type of tree (apples, pears, cherries, plums, peaches, apricots)
  • URL: Link to product page on fedcoseeds.com
  • Product ID: Numeric identifier extracted from URL (e.g., 7204)
  • Zone: USDA hardiness zone (e.g., Z3, Z4, Z5)
  • Season: Harvest season (summer, fall, winter)
  • Description: Detailed variety description with growing information
  • Scientific Name: Latin/botanical name (e.g., Malus domestica)
  • Origin: Geographic and/or historical origin information
  • Characteristics: Special traits including:
    • Disease resistance (scab, fireblight, etc.)
    • Bearing patterns (annual, biennial)
    • Uses (fresh eating, cider, cooking, storage)
  • Rootstock Options: Available rootstock configurations with:
    • Rootstock type (M111, M7, Bud 9, G5, Standard, etc.)
    • Size category (Dwarf, Semi-Dwarf, Standard)
    • Height range (e.g., "2½–5' bare-root")
    • Price (in USD)
    • Item code for ordering (e.g., 7204-A, 7204-C)

Example Output

Summary View (default)

Found 2 matching trees:

Liberty (apples)
  Zone: Z4 | Season: Late summer-fall | Sizes: Semi-Dwarf, Standard | Price: $36.00
  Medium size, crisp white flesh. All-purpose. Keeps till late fall. Scab-immune. Annual bearer.

Ashmead's Kernel (apples)
  Zone: Z4 | Season: Winter | Sizes: Semi-Dwarf, Standard | Price: $36.00
  An after-dinner apple of unparalleled quality. Intense aromatic sting of sharp and sweet.

Detailed View (--detailed)

=== Ashmead's Kernel Apple ===
Category: apples
URL: https://fedcoseeds.com/trees/ashmeads-kernel-apple-7204
Product ID: 7204
Hardiness Zone: Z4
Season: Summer
Scientific Name: Malus domestica
Origin: Unknown parentage. Gloucester, England, about 1700. Possibly a seedling of Nonpareil.

Description:
Winter. An after-dinner apple of unparalleled quality. Not for those who like sweet mild
apples. Each bite is an intense aromatic sting of sharp and sweet, with hints of other
indescribable but absolutely wonderful tastes and aftertastes. Beginning to show up here
and there in commercial orchards. A good sharp addition to hard cider. Medium-small oblate
and lopsided orange-gold-green russet fruits ripen in October. Store until New Year to reach
perfection. Keeps until they're all gone. Moderately vigorous tree may bear irregularly, but
it's worth the wait. Somewhat scab resistant. Blooms midseason. Z4.

ships in spring

Rootstock Options:
  standard rootstock (Standard): $36.00 [7204-A]
  M111 semi-dwarfing rootstock (Semi-Dwarf): $36.00 [7204-C]

Characteristics:
  • Scab resistant

Technical Details

Rootstock Size Categories

The tool automatically categorizes rootstocks based on their type:

  • Dwarf (25-55% of standard size): Bud 9, M9, G41, G65
  • Semi-Dwarf (55-85% of standard size): M111, M7, M26, Bud 118, G5, G890, G210, G222
  • Standard (100% size): Standard rootstock, Seedling, Antonovka

Data Extraction Features

  • Smart Pattern Matching: Extracts rootstock descriptions like "A: 1 on standard rootstock" and pairs them with corresponding item codes
  • Deduplication: Prevents duplicate entries across paginated results
  • UTF-8 Safe: Properly handles special characters and unicode
  • Fallback Mechanisms: Multiple extraction strategies ensure maximum data capture
  • Price Filtering: Automatically excludes bulk pricing to show individual tree prices

Scraping Behavior

  • Respectful Crawling: 500ms delay between requests to avoid overloading the server
  • Pagination Support: Automatically handles multi-page category listings
  • Error Handling: Gracefully handles missing data and page structure variations
  • Seen URL Tracking: Prevents re-scraping the same product across pages

Common Use Cases

Finding Cold-Hardy Cider Apples

./target/release/fedco-trees search --zone Z3 --query "cider" --category apples

Browsing Dwarf Fruit Trees for Small Spaces

./target/release/fedco-trees browse --input trees.json
# Then press 's' and enter "dwarf"

Finding Disease-Resistant Varieties

./target/release/fedco-trees search --query "scab resistant" --detailed
./target/release/fedco-trees search --query "disease resistant"

Getting Ordering Information for a Specific Variety

./target/release/fedco-trees search --query "Ashmead" --detailed
# Shows item codes like [7204-A] for standard, [7204-C] for semi-dwarf

Comparing Prices Across Categories

./target/release/fedco-trees search --max-price 35.00 --detailed

Known Limitations

  • Requires periodic re-scraping to get updated availability and pricing
  • Some trees may have incomplete data if not available on the source website
  • Origin field occasionally contains JavaScript errors from the source page
  • HTML structure changes on Fedco's website may require code updates

Data Files

After scraping, you'll have JSON files containing tree data:

  • trees.json - Default output file
  • Can be loaded by search and browse commands
  • Portable across different systems
  • Can be version controlled for tracking changes over time

Dependencies

  • reqwest (0.11): HTTP client for web scraping with blocking support
  • scraper (0.19): HTML parsing and CSS selector support
  • serde (1.0) + serde_json: JSON serialization/deserialization
  • clap (4.5): Command-line argument parsing with derive macros
  • regex (1.10): Pattern matching for data extraction
  • tokio (1.0): Async runtime (full features)
  • anyhow (1.0): Error handling
  • ratatui (0.28): Terminal user interface framework
  • crossterm (0.28): Cross-platform terminal manipulation

Contributing

Contributions are welcome! Areas for improvement:

  • Additional filtering options
  • Export to other formats (CSV, SQLite)
  • More sophisticated TUI features
  • Better error reporting
  • Support for other Fedco catalog sections

License

BSD 3-Clause License - See LICENSE file for details

Disclaimer

This tool is not affiliated with Fedco Seeds. It is an independent project created to help gardeners and orchardists research and compare fruit tree varieties. Please respect Fedco's website by using reasonable scraping intervals and consider purchasing trees through their official ordering system to support their work.

Author

Created for personal orchard planning and variety research.

Version History

  • v0.1.0 - Initial release with scraping, search, and TUI capabilities
  • Item code extraction for accurate ordering
  • Enhanced rootstock categorization (Dwarf/Semi-Dwarf/Standard)
  • Case-insensitive filtering
  • Fixed duplicate rootstock entries
  • Improved pattern matching for complex rootstock descriptions
Commit count: 0

cargo fmt