Facility: 047155

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
047155
Name
K&L Storage
URL
http://www.kandlstorage.com/
Address
N/A
Platform
custom_facility_047155
Parser File
src/parsers/custom/facility_047155_parser.py
Last Scraped
2026-03-23 03:17:37.015704
Created
2026-03-06 23:45:35.865957
Updated
2026-03-23 03:17:37.015704
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_047155_parser.py)
"""Parser for K&L Storage facility (047155).

This is a WordPress-based site that lists pricing on a dedicated
/locations-pricing/ page. Each unit category is shown as a row with an
<h3> heading containing the size label, dimensions, and starting price.

The page URL differs from the facility's main URL, so the parser targets
the /locations-pricing/ subpage by accepting snapshots of that page.
"""

from __future__ import annotations

import re

from bs4 import BeautifulSoup

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


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

    Pricing is displayed on the /locations-pricing/ page as <h3> headings
    inside .row divs under a section with id="redSection". Each heading
    has the format:

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

    platform = "custom_facility_047155"

    # Matches optional dimensions like "5' x 5'" or "10' x 15' - 10' x 20'"
    _DIM_RE = re.compile(
        r"(\d+(?:\.\d+)?)['\u2019\u2032]?\s*[xX\u00d7]\s*(\d+(?:\.\d+)?)['\u2019\u2032]?",
        re.IGNORECASE,
    )

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

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

        # Locate the pricing section by its id
        section = soup.find(id="redSection")
        if not section:
            # Fallback: find an h1 with "PRICING INFORMATION"
            h1 = soup.find(re.compile(r"h[1-6]"), string=re.compile(r"PRICING INFORMATION", re.IGNORECASE))
            if h1:
                section = h1.find_parent("section") or h1.parent.parent

        if not section:
            result.warnings.append("Pricing section not found — is this the /locations-pricing/ page?")
            return result

        rows = section.find_all("div", class_="row")
        if not rows:
            result.warnings.append("No .row elements found inside pricing section")
            return result

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

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

            # Extract starting price
            price_match = self._PRICE_RE.search(heading_text)
            if not price_match:
                continue
            price = float(price_match.group(1).replace(",", ""))

            # Extract dimensions (first pair wins for the size string)
            dim_matches = list(self._DIM_RE.finditer(heading_text))

            if dim_matches:
                first = dim_matches[0]
                width = float(first.group(1))
                length = float(first.group(2))
                size = f"{int(width)}' x {int(length)}'"
                metadata: dict = {
                    "width": width,
                    "length": length,
                    "sqft": width * length,
                }
                # If there is a second dimension (range), record it too
                if len(dim_matches) > 1:
                    second = dim_matches[1]
                    metadata["width_max"] = float(second.group(1))
                    metadata["length_max"] = float(second.group(2))
                    size = f"{int(width)}' x {int(length)}' - {int(float(second.group(1)))}' x {int(float(second.group(2)))}'"
            else:
                # No explicit dimensions (e.g. "XTRA LARGE", "BOAT & RV STORAGE")
                # Derive a human-readable size label from the heading
                label = re.sub(r"\s*[-–]\s*Starting.*", "", heading_text, flags=re.IGNORECASE).strip()
                size = label
                metadata = {}

            unit = UnitResult(
                size=size,
                price=price,
                description=heading_text,
                metadata=metadata,
            )
            result.units.append(unit)

        if not result.units:
            result.warnings.append("Pricing section found but no unit rows matched")

        return result

Scrape Runs (5)

Run #518 Details

Status
exported
Parser Used
Facility047155Parser
Platform Detected
unknown
Units Found
0
Stage Reached
exported
Timestamp
2026-03-14 16:53:14.735536
Timing
Stage Duration
Fetch1804ms
Detect1ms
Parse0ms
Export12ms

Snapshot: 047155_20260314T165316Z.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:37.003159

No units extracted for 047155

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

No units extracted for 047155

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

No units extracted for 047155

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

No units extracted for 047155

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

No units extracted for 047155

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

← Back to dashboard