Files
jobboard/plugins/readers/recruitee.py
T
WolfandClaude Opus 5.5 4316624769 Declare READS for Oracle, Personio, Phenom, Pinpoint, Recruitee, Rippling, SmartRecruiters, SuccessFactors, Teamtailor, Workable and Workday
Every row carries places (Personio additionalOffices, Workable and Recruitee
locations[], every SuccessFactors address, Workday's own read), the list
teaser of Phenom and Oracle is kept in teaser, and the level, employment and
country a host states are mapped. Workday "N Locations" and "Country - City",
and Recruitee "Remote job", are no longer places. Phenom takes dateCreated
as posted. robots_page and ROBOTS_ANY_CASE go; READS.robots records the
decision. Signatures are feed_url(slug, ask) and page(get, slug, cursor, ask),
with an empty Ask as the default so the runner of today still calls them.

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

173 lines
6.3 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
import logging
from collections.abc import Callable
from typing import Any
from desk.sources import strip_html
from ._contract import Ask, Fields, Place, Reads
from ._shared import Row, is_web_url, label_slug_ok, num, only, parse_dt, pay_line, yearly_amount
log = logging.getLogger(__name__)
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", country="stated",
seniority="stated", employment="stated"),
robots="api: no robots.txt check needed (public board API), 2026-09-30",
)
#: `experience_code` -> the app's levels. `experienced` names no level and is
#: known, so it maps to none; a word not listed is logged at debug level.
_SENIORITY = {"student_school": "intern", "entry_level": "junior", "mid_level": "mid",
"experienced": ""}
#: The words of `employment_type_code` (`fulltime_permanent`), the first that
#: is found deciding, so a contract type beats the hours.
_EMPLOYMENT = (("internship", "internship"), ("intern", "internship"),
("freelance", "contract"), ("contract", "contract"),
("temporary", "temporary"), ("fixed", "temporary"),
("parttime", "part_time"), ("fulltime", "full_time"))
#: 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 _seniority(code: str) -> str | None:
key = code.strip().lower()
if key not in _SENIORITY:
if key:
log.debug("recruitee: unknown experience_code %r", code)
return None
return _SENIORITY[key] or None
def _employment(code: str) -> str | None:
words = set(code.strip().lower().replace("-", "_").split("_"))
for word, value in _EMPLOYMENT:
if word in words:
return value
if code.strip():
log.debug("recruitee: unknown employment_type_code %r", code)
return None
def _places(offer: dict[str, Any]) -> tuple[list[Place], set[str]]:
"""Every place of an offer and the countries' codes among them. `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] = []
codes: set[str] = set()
def add(text: str) -> None:
text = text.strip()
if text and text.lower() not in _NO_PLACE and text not in (p["text"] for p in found):
found.append({"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 code := str(loc.get("country_code") or "").strip().upper():
codes.add(code)
if not found:
add(str(offer.get("location") or offer.get("city") or ""))
if code := str(offer.get("country_code") or "").strip().upper():
codes.add(code)
if not found and offer.get("remote"):
found.append({"text": "Remote", "remote": True})
return found, codes
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, codes = _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": strip_html(j.get("description") or ""),
"remote": j.get("remote"),
"salary_text": _salary_text(salary),
"salary_min": salary_min,
"salary_max": salary_max,
"currency": currency,
"country": next(iter(codes)) if len(codes) == 1 else None,
"seniority": _seniority(str(j.get("experience_code") or "")),
"employment": _employment(str(j.get("employment_type_code") or "")),
})
return rows