Facility: 090746

K&L Storage

Stale Data Warning: This facility has not been successfully scraped in 30 days (threshold: 3 days). Data may be outdated.
Facility Information active
Facility ID
090746
Name
K&L Storage
URL
http://www.kandlstorage.com/
Address
N/A
Platform
custom_facility_090746
Parser File
src/parsers/custom/facility_090746_parser.py
Last Scraped
2026-03-23 03:17:31.114351
Created
2026-03-06 23:45:35.865957
Updated
2026-03-23 03:17:31.114351
Parser & Healing Diagnosis needs_fix
Parser Status
⚠ Needs Fix
Status Reason
Parser returned 0 units
Last Healing Attempt
Not attempted
Parser Source (src/parsers/custom/facility_090746_parser.py)
"""Parser for K&L Storage, Casper Wyoming.

This is a WordPress site that lists pricing as grouped category headings on
the /locations-pricing/ page.  Each heading contains a size range and a
"Starting at $XX" price in a single <h3> element inside a .row div.

Example heading text:
    X-SMALL 5' x 5' or Similar  – Starting at $40
    SMALL 5' x 10' or Similar  – Starting at $60
    LARGE 10' x 15' - 10' x 20' or Similar  – Starting at $95
    XTRA LARGE  – Starting at $200
    BOAT & RV STORAGE  – Starting at $40
"""

from __future__ import annotations

import re

from bs4 import BeautifulSoup

from src.parsers.base import BaseParser, ParseResult, UnitResult

# Matches "Starting at $40" or "Starting at $200"
_PRICE_RE = re.compile(r"Starting\s+at\s+\$([\d,]+(?:\.\d+)?)", re.IGNORECASE)

# Matches a dimension like "5' x 5'" or "10' x 20'" (with optional smart quotes)
_SIZE_RE = re.compile(
    r"(\d+(?:\.\d+)?)\s*['\u2019\u2032]?\s*[xX\u00d7]\s*(\d+(?:\.\d+)?)\s*['\u2019\u2032]?",
)

# Maps size category label prefixes to a human-readable description fallback
_CATEGORY_LABELS = {
    "X-SMALL": "X-Small",
    "SMALL": "Small",
    "MEDIUM": "Medium",
    "LARGE": "Large",
    "XTRA LARGE": "Extra Large",
    "EXTRA LARGE": "Extra Large",
    "BOAT": "Boat & RV Storage",
    "RV": "RV Storage",
}


class Facility090746Parser(BaseParser):
    """Extract storage unit categories from K&L Storage pricing page."""

    platform = "custom_facility_090746"

    def parse(self, html: str, url: str = "") -> ParseResult:
        soup = BeautifulSoup(html, "lxml")
        result = ParseResult(platform=self.platform, parser_name=self.__class__.__name__)

        # Unit rows are .row divs that contain an h3 with pricing text
        rows = soup.select("div.row")

        for row in rows:
            h3 = row.find("h3")
            if not h3:
                continue

            heading_text = h3.get_text(separator=" ", strip=True)

            # Only process rows that contain a price
            price_match = _PRICE_RE.search(heading_text)
            if not price_match:
                continue

            price = float(price_match.group(1).replace(",", ""))

            # Attempt to extract a size dimension from the heading
            size_match = _SIZE_RE.search(heading_text)
            if size_match:
                width = float(size_match.group(1))
                length = float(size_match.group(2))
                size_label = f"{int(width)}' x {int(length)}'"
                metadata: dict = {
                    "width": width,
                    "length": length,
                    "sqft": width * length,
                }
            else:
                # No dimension found — use the category label as the size
                size_label = self._extract_category_label(heading_text)
                metadata = {}

            unit = UnitResult(
                size=size_label,
                price=price,
                description=heading_text,
                url=url or "https://www.kandlstorage.com/locations-pricing/",
                metadata=metadata if metadata else None,
            )
            result.units.append(unit)

        if not result.units:
            result.warnings.append("No unit pricing rows found on page")

        return result

    @staticmethod
    def _extract_category_label(text: str) -> str:
        """Return a readable category label from a heading string."""
        upper = text.upper()
        for key, label in _CATEGORY_LABELS.items():
            if upper.startswith(key):
                return label
        # Fall back to the text before the dash separator
        parts = re.split(r"\s*[–—-]\s*", text)
        return parts[0].strip() if parts else text.strip()

Scrape Runs (5)

Run #34 Details

Status
exported
Parser Used
TableParser
Platform Detected
unknown
Units Found
0
Stage Reached
exported
Timestamp
2026-03-13 19:10:07.552916
Timing
Stage Duration
Fetch2447ms
Detect59ms
Parse0ms
Export10ms

Snapshot: 090746_20260313T191010Z.html · Show Snapshot · Open in New Tab

No units found in this run.

All Failures for this Facility (5)

parse _WarningAsException scraper no_units_extracted warning Run #N/A | 2026-03-23 03:17:31.109157

No units extracted for 090746

Stack trace
src.reporting.failure_reporter._WarningAsException: No units extracted for 090746
parse _WarningAsException scraper no_units_extracted warning Run #N/A | 2026-03-21 19:10:22.031967

No units extracted for 090746

Stack trace
src.reporting.failure_reporter._WarningAsException: No units extracted for 090746
parse _WarningAsException scraper no_units_extracted warning Run #N/A | 2026-03-14 16:53:11.929346

No units extracted for 090746

Stack trace
src.reporting.failure_reporter._WarningAsException: No units extracted for 090746
parse _WarningAsException scraper no_units_extracted warning Run #N/A | 2026-03-14 01:04:40.382698

No units extracted for 090746

Stack trace
src.reporting.failure_reporter._WarningAsException: No units extracted for 090746
parse _WarningAsException scraper no_units_extracted warning Run #N/A | 2026-03-13 19:10:10.118714

No units extracted for 090746

Stack trace
src.reporting.failure_reporter._WarningAsException: No units extracted for 090746

← Back to dashboard