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

+50 -10
View File
@@ -30,13 +30,29 @@ from __future__ import annotations
import html
import json
import logging
import re
from collections.abc import Callable
from typing import Any
from desk.sources import strip_html
from ._shared import Get, Page, Row, only, parse_dt
from ._contract import Ask, Fields, Place, Reads, Row
from ._shared import Get, Page, only, parse_dt
log = logging.getLogger(__name__)
READS = Reads(
scope="board", listing="paged", page_size=100, text="listing", complete="stated",
places="many",
fields=Fields(posted="listed", country="stated", employment="stated"),
robots="read: robots.txt allows /jobs, with crawl-delay 5 not honoured (checked 2026-09-29)",
)
#: `employment_type` -> the app's employment words.
_EMPLOYMENT = {"FULL_TIME": "full_time", "PART_TIME": "part_time", "CONTRACTOR": "contract",
"CONTRACT": "contract", "TEMPORARY": "temporary", "INTERN": "intern",
"INTERNSHIP": "intern", "FREELANCE": "freelance"}
NAME = "jibe"
LABEL = "Jibe"
@@ -73,11 +89,7 @@ def careers_url(slug: str) -> str:
return f"https://{slug.lower()}/jobs"
def robots_page(slug: str) -> str:
return careers_url(slug)
def page(get: Get, slug: str, cursor: Any) -> Page:
def page(get: Get, slug: str, cursor: Any, ask: Ask) -> Page:
"""One page of `/api/jobs`; the next is the following number, and an empty
page ends the read."""
number = int(cursor or 1)
@@ -99,6 +111,21 @@ def _plain(markup: Any) -> str:
return " ".join(html.unescape(strip_html(str(markup or ""))).split())
def _places(j: dict[str, Any]) -> list[Place]:
"""`full_location` names every place of the role, "; " apart, each as
"City, Country"; the site's `city` and `country` stand in when it is
missing."""
line = str(j.get("full_location") or "").strip() \
or ", ".join(p for p in (j.get("city"), j.get("country")) if p)
out: list[Place] = []
for part in line.split(";"):
text = part.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})
return out
def rows(data: dict[str, Any], slug: str) -> list[Row]:
"""One page: each `jobs[].data` has `slug` (equal to `req_id`), `title`,
the HTML `description` and, on some, `qualifications`, `full_location`
@@ -117,16 +144,29 @@ def rows(data: dict[str, Any], slug: str) -> list[Row]:
categories = j.get("categories") or []
text = "\n\n".join(p for p in (_plain(j.get("description")),
_plain(j.get("qualifications"))) if p)
out.append({
places = _places(j)
row: Row = {
"source_id": role,
"title": title,
"location": (j.get("full_location")
or ", ".join(p for p in (j.get("city"), j.get("country")) if p)).strip(),
"places": places,
"location": "; ".join(p["text"] for p in places),
"url": f"https://{slug.lower()}/jobs/{role}",
"posted": parse_dt(j.get("posted_date")),
"department": str((categories[0] if categories else {}).get("name") or "").strip(),
"description": text,
"remote": None,
"salary_text": "",
})
}
# One code, for a role at one place: over several countries it would
# gate the others by the site's own.
code = str(j.get("country_code") or "").strip().upper()
if len(places) == 1 and re.fullmatch(r"[A-Z]{2}", code):
row["country"] = code
kind = str(j.get("employment_type") or "").strip()
if kind:
if employment := _EMPLOYMENT.get(kind.upper()):
row["employment"] = employment
else:
log.debug("jibe: unknown employment_type %r", kind)
out.append(row)
return out