Files
jobboard/plugins/readers/recruitee.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

133 lines
4.7 KiB
Python

"""Recruitee: `recruitee:<subdomain>`, the whole board in one JSON answer
from the company's own subdomain of recruitee.com.
Written from one real board on 2026-09-23; jobhunt-hq did not read
Recruitee.
"""
from __future__ import annotations
import json
from collections.abc import Callable
from typing import Any
from ._contract import Ask, Fields, Place, Reads
from ._shared import Row, add_place, html_text, is_web_url, label_slug_ok, num, only, parse_dt, pay_line, yearly_amount
NAME = "recruitee"
LABEL = "Recruitee"
RANK = 60
PATTERNS = (r"https?://([a-z0-9-]+)\.recruitee\.com",)
READS = Reads(
scope="board", listing="whole", text="listing", complete="whole",
places="many",
fields=Fields(pay="figures", posted="trusted", remote="stated",
seniority="stated", employment="stated"),
robots=("read: <slug>.recruitee.com's robots.txt disallows /v/ only, so /api/offers/ "
"is allowed (famly, checked 2026-09-30)"),
)
#: What the board writes as a place for a role that is worked anywhere.
_NO_PLACE = ("remote job",)
def slug_ok(slug: str) -> bool:
return label_slug_ok(slug)
def allowed(slug: str) -> Callable[[str], bool]:
"""The company's own subdomain, so one company's slug cannot pass for
another's."""
return only(f"{slug}.recruitee.com")
def careers_url(slug: str) -> str:
return f"https://{slug}.recruitee.com"
def feed_url(slug: str, ask: Ask = Ask()) -> str:
return f"https://{slug}.recruitee.com/api/offers/"
def probe_url(slug: str) -> str:
return feed_url(slug)
def probe_ok(body: bytes) -> bool:
return b'"offers":[' in body and b'"offers":[]' not in body
def _salary_text(salary: dict[str, Any]) -> str:
"""One line from Recruitee's `salary` object; `period` is already a
plain word ("year", "month")."""
period = str(salary.get("period") or "").strip().lower()
return pay_line(num(salary.get("min")), num(salary.get("max")),
salary.get("currency"), period)
def _places(offer: dict[str, Any]) -> list[Place]:
"""Every place of an offer. `locations`
lists them (city, state, country), `location` is the first as one line and
is the fallback for an offer that lists none. The board writes "Remote
job" where an offer has no place: that is not one, and a remote offer with
no other place has the place "Remote"."""
found: list[Place] = []
def add(text: str) -> None:
text = text.strip()
if text.lower() not in _NO_PLACE:
add_place(found, {"text": text, "remote": None})
for loc in offer.get("locations") or []:
if not isinstance(loc, dict):
continue
parts: list[str] = []
for part in (loc.get("city") or loc.get("name"), loc.get("state"), loc.get("country")):
part = str(part or "").strip()
if part and part not in parts:
parts.append(part)
add(", ".join(parts))
if not found:
add(str(offer.get("location") or offer.get("city") or ""))
if not found and offer.get("remote"):
found.append({"text": "Remote", "remote": True})
return found
def parse(body: bytes, slug: str) -> list[Row]:
"""`{slug}.recruitee.com/api/offers/` -> `{"offers": [...]}`. An offer has
`locations` (a list; 9 of 16 at bunq have two or three), `remote`,
`experience_code` and `employment_type_code`, and the salary object."""
data = json.loads(body)
rows = []
for j in data.get("offers") or []:
title = (j.get("title") or "").strip()
url = (j.get("careers_url") or "").strip()
if not title or not is_web_url(url):
continue
salary = j.get("salary") if isinstance(j.get("salary"), dict) else {}
salary_min, salary_max, currency = yearly_amount(
salary.get("min"), salary.get("max"), salary.get("currency"),
salary.get("period"), {"year": 1, "month": 12})
places = _places(j)
rows.append({
"source_id": str(j.get("id") or ""),
"title": title,
"places": places,
"location": "; ".join(p["text"] for p in places),
"url": url,
"posted": parse_dt(j.get("published_at") or j.get("created_at")),
"department": (j.get("department") or "").strip(),
"description": html_text(j.get("description")),
"remote": j.get("remote"),
"salary_text": _salary_text(salary),
"salary_min": salary_min,
"salary_max": salary_max,
"currency": currency,
"seniority": str(j.get("experience_code") or "").strip() or None,
"employment": str(j.get("employment_type_code") or "").strip() or None,
})
return rows