Hosts a to l declare READS: places, teaser, stated seniority and employment

Ashby, BambooHR, Deel, Eightfold, Gem, Greenhouse, HiBob, HR Manager, Jibe,
Jobylon and Lever move to feed_url(slug, ask) and page(get, slug, cursor, ask),
declare READS with the robots decision, and drop robots_page. Rows carry
places (Ashby secondaryLocations, Lever allLocations, Greenhouse offices in
place of a Hybrid placeholder), Jobylon keeps its summary as teaser and maps
experience and employment, Eightfold reads creationTs as the posting date and
Ashby reads workplaceType. Fixtures <name>-places.* and jobylon-teaser.html
drive the conformance checks; the eleven names leave UNDECLARED.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
WolfandClaude Opus 5.5 committed 2026-09-30 09:11:53 +02:00
1 parent 4c0da58da7
commit f2e652a8da
35 files changed
+1290 -391

No files matched your search

+45 -3
View File
@@ -8,12 +8,14 @@ from __future__ import annotations
import html
import json
import re
from collections.abc import Callable
from typing import Any
from desk.sources import strip_html
from ._shared import Row, is_web_url, num, only, parse_dt, path_slug_ok, pay_line
from ._contract import Ask, Fields, Place, Reads, Row
from ._shared import is_web_url, num, only, parse_dt, path_slug_ok, pay_line
NAME = "greenhouse"
LABEL = "Greenhouse"
@@ -23,8 +25,22 @@ PATTERNS = (
r"greenhouse\.io/embed/job_board/js\?for=([A-Za-z0-9_-]+)",
)
READS = Reads(
scope="board", listing="whole", text="listing", complete="whole",
places="many",
fields=Fields(pay="figures", posted="trusted"),
robots="api: no robots.txt check needed (public board API), 2026-09-30",
)
_API = "boards-api.greenhouse.io"
#: What a board writes as `location.name` when it means a way of working, not a
#: place (Cloudflare: "Hybrid", "In-Office", "Distributed; Hybrid"). The real
#: places are then in `offices`.
_PLACEHOLDER = re.compile(
r"(?:(?:hybrid|in[- ]?office|on[- ]?site|remote|distributed|flexible|office)"
r"(?:\s+or\s+|\s*[;/,&]\s*|\s+)?)+", re.I)
def slug_ok(slug: str) -> bool:
return path_slug_ok(slug)
@@ -38,7 +54,7 @@ def careers_url(slug: str) -> str:
return f"https://job-boards.greenhouse.io/{slug}"
def feed_url(slug: str) -> str:
def feed_url(slug: str, ask: Ask) -> str:
return f"https://{_API}/v1/boards/{slug}/jobs?content=true&pay_transparency=true"
@@ -107,6 +123,30 @@ def _salary_text(ranges: list[dict[str, Any]]) -> str:
return "; ".join(lines)
def _places(j: dict[str, Any]) -> list[Place]:
"""The role's places: each of `offices` (present with `content=true`), in
the host's words, or, when there is none, `location.name` as stated. A
`location.name` that only names a way of working ("Hybrid") is not a
place: the offices replace it."""
name = ((j.get("location") or {}).get("name") or "").strip()
out: list[Place] = []
for office in j.get("offices") or []:
text = str((office or {}).get("location") or (office or {}).get("name") or "").strip()
if text and text not in (p["text"] for p in out):
out.append({"text": text, "remote": True if re.search(r"\bremote\b", text, re.I)
else None})
if not out or not name or _PLACEHOLDER.fullmatch(name):
return out or ([{"text": name, "remote": True if re.search(r"\bremote\b", name, re.I)
else None}] if name else [])
# A name that says something the offices do not (a "Remote India" beside
# an office in Bangalore) is one more place; one they already contain,
# or that contains them, is the same place said twice.
low = name.lower()
if any(p["text"].lower() in low or low in p["text"].lower() for p in out):
return out
return [{"text": name, "remote": True if re.search(r"\bremote\b", name, re.I) else None}, *out]
def parse(body: bytes, slug: str) -> list[Row]:
data = json.loads(body)
rows = []
@@ -122,10 +162,12 @@ def parse(body: bytes, slug: str) -> list[Row]:
content = html.unescape(j.get("content") or "")
ranges = j.get("pay_input_ranges") or []
salary_min, salary_max, currency = _salary(ranges)
places = _places(j)
rows.append({
"source_id": str(j.get("id") or ""),
"title": title,
"location": ((j.get("location") or {}).get("name") or "").strip(),
"places": places,
"location": "; ".join(p["text"] for p in places),
"url": url,
"posted": parse_dt(j.get("first_published") or j.get("updated_at")),
"department": (departments[0].get("name") if departments else "") or "",