Files
jobboard/plugins/readers/rippling.py
T
WolfandClaude Opus 5.5 c497fe965d Keep a description's headings, bullets and paragraphs, and draw them in the reader
The readers flattened a posting's HTML into one line with strip_html, so
sections and bullets ran together. _shared.html_text gives a line per
paragraph, '• ' before a list item and '## ' before a heading; every
reader's description goes through it, sections read per role get their
own headings, and the reader pane draws the lines as h3, ul and p.
Excerpts leave the marks out.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-09-30 21:40:12 +02:00

140 lines
5.4 KiB
Python

"""Rippling: `rippling:<board slug>` for ats.rippling.com/<slug>, the whole
board in one JSON array, the description on each role's own record.
Written from Prisma's board (`prisma-careers`, two roles) and Rippling's own
(`rippling`, 326 roles) on 2026-09-29. The careers site's script reads the
public board API, `api.rippling.com/platform/api/ats/v1/board/<slug>/jobs`,
which needs no key. The slug is case-sensitive (`Prisma-Careers` is "Job
Board not found").
"""
from __future__ import annotations
import json
import re
from collections.abc import Callable
from typing import Any
from ._contract import Ask, Fields, Place, Reads
from ._shared import Get, Row, add_place, html_text, parse_dt, yearly_amount
NAME = "rippling"
LABEL = "Rippling"
KEEP_CASE = True
PATTERNS = (
r"ats\.rippling\.com/([A-Za-z0-9][A-Za-z0-9_-]*)",
r"api\.rippling\.com/platform/api/ats/v1/board/([A-Za-z0-9][A-Za-z0-9_-]*)",
)
READS = Reads(
scope="board", listing="whole", text="detail", complete="whole", places="many",
fields=Fields(pay="figures", posted="trusted", employment="stated"),
robots=("read: robots.txt allows /<slug>/jobs on ats.rippling.com, the API host has none "
"(checked 2026-09-29)"),
)
_API = "api.rippling.com"
_SITE = "ats.rippling.com"
#: A slug is one path segment that starts with a letter or a digit, matched
#: whole; it is also what discovery's patterns take.
_SLUG = re.compile(r"[A-Za-z0-9][A-Za-z0-9_-]*")
#: A role's id in the board's own links.
_UUID = re.compile(r"[0-9A-Za-z-]{8,64}")
def slug_ok(slug: str) -> bool:
return bool(_SLUG.fullmatch(slug))
def allowed(slug: str) -> Callable[[str], bool]:
return lambda host: host.lower() in (_API, _SITE)
def careers_url(slug: str) -> str:
return f"https://{_SITE}/{slug}/jobs"
def _board(slug: str) -> str:
return f"https://{_API}/platform/api/ats/v1/board/{slug}"
def _place(text: str) -> Place:
"""A place as the board labels it; "Remote (United States)" is remote, any
other label says nothing."""
return {"text": text, "remote": True if text.lower().startswith("remote") else None}
def feed_url(slug: str, ask: Ask = Ask()) -> str:
return f"{_board(slug)}/jobs"
def parse(body: bytes, slug: str) -> list[Row]:
"""The board's array -> one row per role. The array has one entry per
role and place, so a role in three cities is three entries with one
`uuid` (Rippling's own board: 638 entries, 326 roles); the rows merge
them, the places kept as a list and joined with "; " for `location`. The entry has no description, date
or pay: `detail` reads them."""
data = json.loads(body)
if not isinstance(data, list):
raise ValueError("not a Rippling board: the answer is not a list")
roles: dict[str, Row] = {}
places: dict[str, list[Place]] = {}
for entry in data:
job_id = str(entry.get("uuid") or "").strip()
title = (entry.get("name") or "").strip()
if not title or not _UUID.fullmatch(job_id):
continue
place = str(((entry.get("workLocation") or {}).get("label")) or "").strip()
places.setdefault(job_id, [])
if place:
add_place(places[job_id], _place(place))
roles.setdefault(job_id, {
"source_id": job_id,
"title": title,
"url": f"https://{_SITE}/{slug}/jobs/{job_id}",
"posted": None,
"department": str(((entry.get("department") or {}).get("label")) or "").strip(),
"description": "",
"salary_text": "", # the board's list states no pay
})
for job_id, row in roles.items():
row["places"] = places[job_id]
row["location"] = "; ".join(p["text"] for p in places[job_id])
return list(roles.values())
def _employment(kind: Any) -> str | None:
"""The host's `employmentType.label` (`SALARIED_FT`), as given."""
return (str(kind.get("label") or "").strip() or None) if isinstance(kind, dict) else None
def detail(get: Get, slug: str, row: Row) -> dict[str, Any]:
"""`<board>/jobs/<uuid>`: the description as HTML (`description.role`, or
the company's text when a role has none), every place in `workLocations`,
`createdOn` for `posted`, and `payRangeDetails`, a range per pay zone.
The columns are only filled for exactly one yearly range, as Greenhouse's
are: with several zones there is no telling which one the role has."""
data = json.loads(get(f"{_board(slug)}/jobs/{row['source_id']}"))
text = data.get("description") or {}
found: dict[str, Any] = {
"description": html_text(text.get("role") or text.get("company")),
"posted": parse_dt(data.get("createdOn")),
}
if names := [p for p in (str(p).strip() for p in data.get("workLocations") or []) if p]:
found["places"] = [_place(name) for name in dict.fromkeys(names)]
found["location"] = "; ".join(dict.fromkeys(names))
if employment := _employment(data.get("employmentType")):
found["employment"] = employment
ranges = data.get("payRangeDetails") or []
if len(ranges) == 1:
pay = ranges[0]
lo, hi, currency = yearly_amount(pay.get("rangeStart"), pay.get("rangeEnd"),
pay.get("currency"), pay.get("frequency"),
{"YEAR": 1, "MONTH": 12})
if currency:
found |= {"salary_min": lo, "salary_max": hi, "currency": currency}
return found