Merge branch 'wp7-small-hosts'

This commit is contained in:
Wolf committed 2026-09-29 20:15:47 +02:00
commit c7c5aebdb6
23 files changed
+3490

No files matched your search

+148
View File
@@ -0,0 +1,148 @@
"""Deel: `deel:<slug>` for jobs.deel.com/<slug>, the whole board in one HTML
page.
Written from Klarna's board on 2026-09-29. Deel's job board is a Next.js page
with no public JSON endpoint (its `/api/` is disallowed by robots.txt), but
the server-rendered page carries the board in its React Server Components
payload: a stream of `self.__next_f.push([1, "..."])` scripts whose strings,
joined, hold `"jobPostings":[...]` with every open role, and, beside it, the
rich-text descriptions as separate text rows that a posting names by
reference (`"richtextDescription":"$1a"`). Klarna's 96 roles came in one
page, the same 96 as the page's own JSON-LD list, so no description needs a
read of the role's page.
"""
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, num, only, parse_dt, pay_line
NAME = "deel"
LABEL = "Deel"
KEEP_CASE = True # `jobs.deel.com/Klarna` is "Job Board Not Found", `/klarna` is the board
PATTERNS = (
# `/job-boards/<slug>` is the address Klarna's own site links to.
r"jobs\.deel\.com/(?:job-boards/)?(?!job-boards\b)([A-Za-z0-9][A-Za-z0-9_-]*)",
)
_HOST = "jobs.deel.com"
#: A slug is one path segment that starts with a letter or a digit, so `_next`
#: and `.` never name a board.
_SLUG = re.compile(r"[A-Za-z0-9][A-Za-z0-9_-]*")
#: One script of the payload, its JSON string literal captured. Kind 1 is
#: the data; the others (`[0]`, `[2, ...]`) carry the bootstrap.
_PUSH = re.compile(r'self\.__next_f\.push\(\[1,("(?:[^"\\]|\\.)*")\]\)')
#: One row of the joined stream: `<hex id>:` and then either `T<hex length>,`
#: and that many bytes of text, or a line of JSON.
_ROW = re.compile(rb"([0-9a-f]*):")
_TEXT = re.compile(rb"T([0-9a-f]+),")
#: Deel's `workArrangementEnum` -> `store._remote`'s words.
_REMOTE = {"ON_SITE": "onsite", "HYBRID": "hybrid", "REMOTE": "remote"}
def slug_ok(slug: str) -> bool:
return bool(_SLUG.fullmatch(slug))
def allowed(slug: str) -> Callable[[str], bool]:
return only(_HOST)
def careers_url(slug: str) -> str:
return f"https://{_HOST}/{slug}"
def robots_page(slug: str) -> str:
return careers_url(slug)
def feed_url(slug: str) -> str:
return careers_url(slug)
def _stream(body: bytes) -> dict[str, str]:
"""The payload's rows by id. A text row's length is in bytes of UTF-8 and
the next row follows it directly, so the stream is read as bytes, one row
after another, rather than split on newlines."""
text = "".join(json.loads(m.group(1)) for m in _PUSH.finditer(body.decode("utf-8", "replace")))
data = text.encode()
out: dict[str, str] = {}
pos = 0
while pos < len(data) and (row := _ROW.match(data, pos)):
pos = row.end()
if data[pos:pos + 1] == b"T" and (size := _TEXT.match(data, pos)):
end = size.end() + int(size.group(1), 16)
out[row.group(1).decode()] = data[size.end():end].decode("utf-8", "replace")
pos = end
else:
end = data.find(b"\n", pos)
end = len(data) if end < 0 else end
out[row.group(1).decode()] = data[pos:end].decode("utf-8", "replace")
pos = end + 1
return out
def _postings(body: bytes) -> tuple[list[dict[str, Any]], dict[str, str]]:
"""The board's postings and the stream they refer into. A page without
the postings array is not a board (a slug Deel does not know answers
"Job Board Not Found"), and raises rather than read as an empty board."""
stream = _stream(body)
for value in stream.values():
start = value.find('"jobPostings":[')
if start >= 0:
postings, _end = json.JSONDecoder().raw_decode(value[start + len('"jobPostings":'):])
return postings, stream
raise ValueError("not a Deel job board: no jobPostings in the page")
def parse(body: bytes, slug: str) -> list[Row]:
"""`jobs.deel.com/<slug>` -> one row per posting. `location` joins the
role's places with "; ". `posted` is the day the posting was published
(its publication's state), not the day the role was drafted.
Deel states pay as a currency and two amounts with no period, and the
amounts run from 775,398 SEK to 55,206 SEK on one board, the latter
plainly a month's pay. A yearly figure cannot be told from a monthly one,
so the columns stay empty and `salary_text` gives the range as stated."""
postings, stream = _postings(body)
out = []
for p in postings:
title = (p.get("title") or "").strip()
post_id = str(p.get("id") or "")
if not title or not post_id:
continue
job = p.get("job") or {}
places = [name for loc in job.get("jobLocations") or []
if (name := ((loc.get("location") or {}).get("name") or "").strip())]
departments = [name for d in job.get("jobDepartments") or []
if (name := ((d.get("department") or {}).get("name") or "").strip())]
pay = job.get("currentCompensation") or {}
published = ((p.get("jobPostingPublications") or [{}])[0].get("currentState") or {})
description = p.get("richtextDescription") or ""
if description.startswith("$"):
description = stream.get(description[1:], "")
out.append({
"source_id": post_id,
"title": title,
"location": "; ".join(dict.fromkeys(places)),
"url": f"https://{_HOST}/{slug}/job-details/{post_id}/overview",
"posted": parse_dt(published.get("createdAt") or p.get("createdAt")),
"department": ", ".join(dict.fromkeys(departments)),
"description": html.unescape(strip_html(description)),
"remote": _REMOTE.get(str(job.get("workArrangementEnum") or "")),
"salary_text": (pay_line(num(pay.get("minAmount")), num(pay.get("maxAmount")),
pay.get("currencyIsoCode"), "")
if p.get("isCompensationVisible") else ""),
})
return out
+113
View File
@@ -0,0 +1,113 @@
"""HiBob: `hibob:<subdomain>` for <subdomain>.careers.hibob.com, the whole
board in one JSON answer.
Written from Dixa's board (two general-application ads) and Liquidia's (14
roles) on 2026-09-29. The careers site's own API,
`<subdomain>.careers.hibob.com/api/job-ad`, answers 401 unless the request
carries the header `companyIdentifier: <subdomain>`. That header is the
company's public subdomain and no key or token, but it is why this is a paged
module, whose `page` may send headers, although it reads one page. Every ad
comes with its texts, so there is no `detail`. Pay is read from the
`payTransparency*` fields as they are named; no board seen so far had them
filled, so the period's spelling is a guess.
"""
from __future__ import annotations
import html
import json
from collections.abc import Callable
from typing import Any
from desk.sources import strip_html
from ._shared import Get, Page, Row, label_slug_ok, num, only, parse_dt, pay_line, yearly_amount
NAME = "hibob"
LABEL = "HiBob"
PATTERNS = (r"https?://([a-z0-9-]+)\.careers\.hibob\.com",)
#: HiBob's `workspaceTypeId` -> `store._remote`'s words.
_REMOTE = {"remote": "remote", "hybrid": "hybrid", "on_site": "onsite", "onsite": "onsite"}
#: The texts of an ad, in the order the ad shows them.
_SECTIONS = ("description", "responsibilities", "requirements", "benefits")
#: A pay period's spellings, as the word `pay_line` and `yearly_amount` take.
_PERIODS = {"year": "year", "yearly": "year", "annual": "year", "annually": "year",
"month": "month", "monthly": "month", "hour": "hour", "hourly": "hour",
"day": "day", "daily": "day", "week": "week", "weekly": "week"}
def _host(slug: str) -> str:
return f"{slug.lower()}.careers.hibob.com"
def slug_ok(slug: str) -> bool:
return label_slug_ok(slug)
def allowed(slug: str) -> Callable[[str], bool]:
return only(_host(slug))
def careers_url(slug: str) -> str:
return f"https://{_host(slug)}/"
def robots_page(slug: str) -> str:
return careers_url(slug)
def page(get: Get, slug: str, cursor: Any) -> Page:
"""The one page: every ad, and no total or cursor, so the board is
complete when the answer parses. The host's robots.txt is its single-page
app's index page (a 200 with no rules), which allows."""
data = json.loads(get(f"https://{_host(slug)}/api/job-ad",
headers={"companyIdentifier": slug.lower(), "Accept": "application/json"}))
ads = data.get("jobAdDetails")
if not isinstance(ads, list):
raise ValueError("not a HiBob board: no jobAdDetails")
return data, [{"id": ad.get("id")} for ad in ads], None, None
def parse(body: bytes, slug: str) -> list[Row]:
return rows(json.loads(body), slug)
def rows(data: dict[str, Any], slug: str) -> list[Row]:
"""One answer -> one row per ad. `location` is the site with its country
(the country left off where the site already names it). `posted` is
`publishedAt`, which has nanoseconds. The description joins the ad's
texts, which are HTML in the ads with sections and plain text elsewhere."""
out = []
for ad in data.get("jobAdDetails") or []:
title = (ad.get("title") or "").strip()
ad_id = str(ad.get("id") or "").strip()
if not title or not ad_id:
continue
site = str(ad.get("site") or "").strip()
country = str(ad.get("country") or "").strip()
location = f"{site}, {country}" if site and country and country.lower() not in site.lower() \
else site or country
text = " ".join(strip_html(str(ad.get(key) or "")) for key in _SECTIONS)
lo, hi = num(ad.get("payTransparencyMinSalary")), num(ad.get("payTransparencyMaxSalary"))
currency = ad.get("payTransparencySalaryCurrency")
period = _PERIODS.get(str(ad.get("payTransparencySalaryPayPeriod") or "").strip().lower(), "")
salary_min, salary_max, code = yearly_amount(lo, hi, currency, period,
{"year": 1, "month": 12})
out.append({
"source_id": ad_id,
"title": title,
"location": location,
"url": f"https://{_host(slug)}/jobs/{ad_id}",
"posted": parse_dt(ad.get("publishedAt")),
"department": str(ad.get("department") or "").strip(),
"description": " ".join(html.unescape(text).split()),
"remote": _REMOTE.get(str(ad.get("workspaceTypeId") or "").strip().lower()),
"salary_text": pay_line(lo, hi, currency, period),
"salary_min": salary_min,
"salary_max": salary_max,
"currency": code,
})
return out
+114
View File
@@ -0,0 +1,114 @@
"""HR Manager (Talentech): `hrmanager:<customer>`, the public RSS of a
company's job portal, paged by `skip` and `take` with no stated total.
Written from four real boards on 2026-09-29: STS Group (6 roles), Flying
Tiger and KPMG (25 or more), and NNIT (none). The feed is
`api.hr-manager.net/JobPortal.svc/<customer>/PositionList/rss/?incads=true`;
without `take` it answers the first 25 roles whatever the board holds, and
`skip` and `take` were seen to page it (25 more with `skip=25`, 100 with
`take=100`). The customer is not case-sensitive (`FLYINGTIGER` answers as
`flyingtiger` does).
robots.txt: the portal's own pages on candidate.hr-manager.net disallow
everything for `*` except the application form, and so `robots_page` is the
feed's URL, on the API host, which has no robots.txt (a 404, which allows).
The feed is the interface HR Manager publishes for readers like this one; the
portal's HTML list, which the robots.txt does shut out, is never read. The
role's link is the application form the robots.txt names as allowed, and is
only shown, not fetched.
"""
from __future__ import annotations
import html
import re
import xml.etree.ElementTree as ET
from collections.abc import Callable
from typing import Any
from desk.sources import strip_html
from ._shared import Get, Page, Row, is_web_url, only, parse_dt
NAME = "hrmanager"
LABEL = "HR Manager"
PATTERNS = (
r"hr-manager\.net/vacancies/list\.aspx\?(?:[^\"'\s#<>]*?[&;])?customer=([A-Za-z0-9][A-Za-z0-9_-]*)",
r"api\.hr-manager\.net/JobPortal\.svc/([A-Za-z0-9][A-Za-z0-9_-]*)/",
)
_API = "api.hr-manager.net"
#: The roles asked for in one page. 100 were served at once at Flying Tiger; the
#: cursor moves on by what a page returned, so a smaller cap on the host's
#: side would not skip a role, and the read ends on an empty page.
PAGE_SIZE = 100
_SLUG = re.compile(r"[A-Za-z0-9][A-Za-z0-9_-]*")
def slug_ok(slug: str) -> bool:
return bool(_SLUG.fullmatch(slug))
def allowed(slug: str) -> Callable[[str], bool]:
return only(_API)
def careers_url(slug: str) -> str:
return f"https://candidate.hr-manager.net/vacancies/list.aspx?customer={slug}"
def _feed(slug: str, skip: int) -> str:
return (f"https://{_API}/JobPortal.svc/{slug}/PositionList/rss/"
f"?incads=true&skip={skip}&take={PAGE_SIZE}")
def robots_page(slug: str) -> str:
return _feed(slug, 0)
def page(get: Get, slug: str, cursor: Any) -> Page:
skip = int(cursor or 0)
items = _items(get(_feed(slug, skip), headers={"Accept": "application/rss+xml"}))
results = [{"id": item.findtext("guid") or item.findtext("link") or ""} for item in items]
return items, results, None, skip + len(items) if items else None
def parse(body: bytes, slug: str) -> list[Row]:
return rows(_items(body), slug)
def _items(body: bytes) -> list[ET.Element]:
"""`<rss><channel><item>...`. A board with no open roles is a channel
with no items, which is an empty board; an answer without a channel is
not a feed, and raises."""
channel = ET.fromstring(body).find("channel")
if channel is None:
raise ValueError("not an HR Manager feed: no channel")
return channel.findall("item")
def rows(items: list[ET.Element], slug: str) -> list[Row]:
"""One page of items. An item has the `guid` (the position's id), `link`
(its application form), `title`, the whole advertisement as escaped HTML
in `description` and `pubDate`. It names no place, department or pay: the
place, where there is one, is in the title or the text."""
out = []
for item in items:
title = (item.findtext("title") or "").strip()
url = (item.findtext("link") or "").strip()
if not title or not is_web_url(url):
continue
out.append({
"source_id": (item.findtext("guid") or url).strip(),
"title": title,
"location": "",
"url": url,
"posted": parse_dt(item.findtext("pubDate")),
"department": "",
"description": html.unescape(strip_html(item.findtext("description") or "")),
"remote": None,
"salary_text": "",
})
return out
+216
View File
@@ -0,0 +1,216 @@
"""Jobylon: `jobylon:<company id>`, the whole board in one HTML page, the
description on each role's own page.
Written from Einride's board (company 3143) and Vipps MobilePay's (1056, no
open roles) on 2026-09-29. Jobylon's own JSON and XML feeds are addressed by a
uuid the company sets and holds, and none is public for these two, so the
board is read from the widget's embed page, `cdn.jobylon.com/jobs/companies/
<id>/embed/v2/`, which assigns `JBL.embed_v2['jobs'] = [...]` as a JavaScript
literal with every open role (33 of 33 at Einride; `page_size` in the URL
the widget is embedded with only sets its client-side page). The literal has
unquoted keys and single-quoted strings, which `_json` reads. It carries no
description, so `detail` reads the role's page on emp.jobylon.com, whose
JSON-LD `JobPosting` has the description, the exact date and every location.
A slug Jobylon does not know answers 404.
"""
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 Get, Row, parse_dt
NAME = "jobylon"
LABEL = "Jobylon"
PATTERNS = (
r"(?:emp|cdn)\.jobylon\.com/(?:jobs/)?companies/(\d+)",
# A company's own site says which board it embeds (careers.einride.tech
# sets `jbl_company_id = 3143`).
r"jbl_company_id[\"']?\s*[=:]\s*[\"']?(\d+)",
)
_CDN = "cdn.jobylon.com"
_EMP = "emp.jobylon.com"
#: A company id, matched whole. The host names are fixed, so a slug can only
#: ever land in a path.
_SLUG = re.compile(r"[0-9]{1,12}")
#: A role's page on the site, as the embed names it (`/jobs/385191-einride-
#: financial-controller/`): the only kind of link the module builds a URL
#: from.
_ROLE_PATH = re.compile(r"/jobs/[0-9]+(?:-[A-Za-z0-9_-]*)?/?")
_ASSIGNMENT = "JBL.embed_v2['jobs'] = "
_KEY = re.compile(r"[A-Za-z_][A-Za-z0-9_]*")
_TRAILING_COMMA = re.compile(r",(\s*[\]}])")
#: Jobylon's `workspace` -> `store._remote`'s words.
_REMOTE = {"remote": "remote", "hybrid": "hybrid", "on-site": "onsite", "onsite": "onsite"}
#: The English month names, by their first three letters, in the spellings
#: `published_date` uses ("Sept. 25, 2026").
_MONTHS = {m: i for i, m in enumerate(
("jan", "feb", "mar", "apr", "may", "jun", "jul", "aug", "sep", "oct", "nov", "dec"), 1)}
_PUBLISHED = re.compile(r"([A-Za-z]{3})[A-Za-z]*\.? (\d{1,2}), (\d{4})")
def slug_ok(slug: str) -> bool:
return bool(_SLUG.fullmatch(slug))
def allowed(slug: str) -> Callable[[str], bool]:
return lambda host: host.lower() in (_CDN, _EMP)
def careers_url(slug: str) -> str:
"""Jobylon answers this with a redirect to `/companies/<id>-<name>/`."""
return f"https://{_EMP}/companies/{slug}/"
def feed_url(slug: str) -> str:
return f"https://{_CDN}/jobs/companies/{slug}/embed/v2/"
def robots_page(slug: str) -> str:
"""The page the board is read from. Both hosts serve the same robots.txt
(compared on 2026-09-29), so the roles' pages on emp.jobylon.com are
covered by the check on this one."""
return feed_url(slug)
def _json(text: str) -> Any:
"""A JavaScript array or object literal as JSON: keys quoted, strings
single-quoted with `\\uXXXX` escapes, trailing commas."""
out: list[str] = []
i, n = 0, len(text)
while i < n:
char = text[i]
if char in "'\"":
i += 1
chars: list[str] = []
while i < n and text[i] != char:
if text[i] == "\\":
i += 1
if text[i] == "u":
chars.append(chr(int(text[i + 1:i + 5], 16)))
i += 4
elif text[i] == "x":
chars.append(chr(int(text[i + 1:i + 3], 16)))
i += 2
else:
chars.append({"n": "\n", "t": "\t", "r": "\r"}.get(text[i], text[i]))
else:
chars.append(text[i])
i += 1
i += 1
out.append(json.dumps("".join(chars)))
elif word := _KEY.match(text, i):
i = word.end()
colon = re.compile(r"\s*:").match(text, i)
out.append(json.dumps(word.group()) if colon else word.group())
else:
out.append(char)
i += 1
return json.loads(_TRAILING_COMMA.sub(r"\1", "".join(out)))
def _literal(body: bytes) -> str:
"""The text of the jobs array: from its `[` to the matching `]`, quotes
respected."""
text = body.decode("utf-8", "replace")
start = text.find(_ASSIGNMENT)
if start < 0:
raise ValueError("not a Jobylon board: no JBL.embed_v2['jobs'] in the page")
start += len(_ASSIGNMENT)
depth, i, quote = 0, start, ""
while i < len(text):
char = text[i]
if quote:
if char == "\\":
i += 1
elif char == quote:
quote = ""
elif char in "'\"":
quote = char
elif char == "[":
depth += 1
elif char == "]":
depth -= 1
if depth == 0:
return text[start:i + 1]
i += 1
raise ValueError("Jobylon's jobs array does not end")
def _published(value: Any) -> Any:
match = _PUBLISHED.fullmatch(str(value or "").strip())
month = _MONTHS.get(match.group(1).lower()) if match else None
if not match or not month:
return None
return parse_dt(f"{match.group(3)}-{month:02d}-{int(match.group(2)):02d}")
def parse(body: bytes, slug: str) -> list[Row]:
"""The embed page -> one row per role. `posted` is the day `published_date`
names, which `detail` replaces with the exact time. `location` joins the
names the embed lists, which can be fewer than the role's places
("Houston +3 more" lists three); `detail` has them all. The embed states
no pay. `department` is the role's `function`, unless it is the
placeholder "All functions"."""
out = []
for j in _json(_literal(body)):
title = (j.get("title") or "").strip()
job_id = str(j.get("id") or "").strip()
path = str(j.get("url") or "").strip()
if not title or not job_id or not _ROLE_PATH.fullmatch(path):
continue
function = str(j.get("function") or "").strip()
out.append({
"source_id": job_id,
"title": title,
"location": "; ".join(dict.fromkeys(
str(name).strip() for name in j.get("locations") or [] if str(name).strip())),
"url": f"https://{_EMP}{path}",
"posted": _published(j.get("published_date")),
"department": "" if function == "All functions" else function,
"description": "",
"remote": _REMOTE.get(str(j.get("workspace") or "").strip().lower()),
"salary_text": "", # the embed states no pay
})
return out
def detail(get: Get, slug: str, row: Row) -> dict[str, Any]:
"""The role's own page: its JSON-LD `JobPosting` has the description, the
time it was posted and each place as "Houston, TX, USA"."""
page = get(row["url"], headers={"Accept": "text/html"}).decode("utf-8", "replace")
for block in re.findall(r'<script type="application/ld\+json"[^>]*>(.*?)</script>',
page, re.S):
try:
data = json.loads(block, strict=False)
except ValueError:
continue
if isinstance(data, dict) and data.get("@type") == "JobPosting":
break
else:
raise ValueError("no JobPosting on the role's page")
places = []
for place in data.get("jobLocation") or []:
address = (place or {}).get("address") or {}
name = str(address.get("streetAddress") or address.get("addressLocality") or "").strip()
if name and name not in places:
places.append(name)
found: dict[str, Any] = {
"description": html.unescape(strip_html(data.get("description") or "")),
"posted": parse_dt(data.get("datePosted")),
}
if places:
found["location"] = "; ".join(places)
return found
+127
View File
@@ -0,0 +1,127 @@
"""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 html
import json
import re
from collections.abc import Callable
from typing import Any
from desk.sources import strip_html
from ._shared import Get, Row, 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_-]*)",
)
_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 robots_page(slug: str) -> str:
"""The page a person opens. The API host has no robots.txt (a 404, which
allows), so the site's is the one that says something."""
return careers_url(slug)
def _board(slug: str) -> str:
return f"https://{_API}/platform/api/ats/v1/board/{slug}"
def feed_url(slug: str) -> 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 joined with "; ". The entry has no description, date
or pay: `detail` reads them. `remote` is True only when every place is a
"Remote (...)" one, since a label says nothing else about the work."""
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[str]] = {}
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 and place not in places[job_id]:
places[job_id].append(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["location"] = "; ".join(places[job_id])
row["remote"] = True if places[job_id] and all(
p.lower().startswith("remote") for p in places[job_id]) else None
return list(roles.values())
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.unescape(strip_html(text.get("role") or text.get("company") or "")),
"posted": parse_dt(data.get("createdOn")),
}
if places := [p for p in (str(p).strip() for p in data.get("workLocations") or []) if p]:
found["location"] = "; ".join(dict.fromkeys(places))
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