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:
1 parent
4c0da58da7
commit
f2e652a8da
35 files changed
+1290
-391
No files matched your search
+41
-9
@@ -16,13 +16,25 @@ 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 Row, num, only, parse_dt, pay_line
|
||||
from ._contract import Ask, Fields, Reads, Row
|
||||
from ._shared import num, only, parse_dt, pay_line
|
||||
|
||||
log = logging.getLogger(__name__)
|
||||
|
||||
READS = Reads(
|
||||
scope="board", listing="whole", text="listing", complete="whole",
|
||||
places="many",
|
||||
fields=Fields(pay="line", posted="listed", remote="stated", employment="stated"),
|
||||
robots="read: robots.txt allows the board page /<slug>; /api/ is disallowed and not read "
|
||||
"(checked 2026-09-29)",
|
||||
)
|
||||
|
||||
NAME = "deel"
|
||||
LABEL = "Deel"
|
||||
@@ -50,6 +62,12 @@ _TEXT = re.compile(rb"T([0-9a-f]+),")
|
||||
#: Deel's `workArrangementEnum` -> `store._remote`'s words.
|
||||
_REMOTE = {"ON_SITE": "onsite", "HYBRID": "hybrid", "REMOTE": "remote"}
|
||||
|
||||
#: The name of a `jobEmploymentTypes` entry -> the app's employment words.
|
||||
_EMPLOYMENT = {"full-time": "full_time", "full time": "full_time", "part-time": "part_time",
|
||||
"part time": "part_time", "contract": "contract", "contractor": "contract",
|
||||
"consultant": "contract", "temporary": "temporary", "intern": "intern",
|
||||
"internship": "intern", "freelance": "freelance"}
|
||||
|
||||
|
||||
def slug_ok(slug: str) -> bool:
|
||||
return bool(_SLUG.fullmatch(slug))
|
||||
@@ -63,11 +81,7 @@ 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:
|
||||
def feed_url(slug: str, ask: Ask) -> str:
|
||||
return careers_url(slug)
|
||||
|
||||
|
||||
@@ -106,9 +120,21 @@ def _postings(body: bytes) -> tuple[list[dict[str, Any]], dict[str, str]]:
|
||||
raise ValueError("not a Deel job board: no jobPostings in the page")
|
||||
|
||||
|
||||
def _employment(job: dict[str, Any]) -> str | None:
|
||||
"""The first `jobEmploymentTypes` entry that names a known type."""
|
||||
for entry in job.get("jobEmploymentTypes") or []:
|
||||
name = str(((entry or {}).get("employmentType") or {}).get("name") or "").strip()
|
||||
if not name:
|
||||
continue
|
||||
if found := _EMPLOYMENT.get(name.lower()):
|
||||
return found
|
||||
log.debug("deel: unknown employment type %r", name)
|
||||
return None
|
||||
|
||||
|
||||
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
|
||||
role's places with "; ", and `places` lists each. `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
|
||||
@@ -132,9 +158,12 @@ def parse(body: bytes, slug: str) -> list[Row]:
|
||||
description = p.get("richtextDescription") or ""
|
||||
if description.startswith("$"):
|
||||
description = stream.get(description[1:], "")
|
||||
out.append({
|
||||
arrangement = str(job.get("workArrangementEnum") or "")
|
||||
remote = {"REMOTE": True, "HYBRID": False, "ON_SITE": False}.get(arrangement)
|
||||
row: Row = {
|
||||
"source_id": post_id,
|
||||
"title": title,
|
||||
"places": [{"text": name, "remote": remote} for name in dict.fromkeys(places)],
|
||||
"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")),
|
||||
@@ -144,5 +173,8 @@ def parse(body: bytes, slug: str) -> list[Row]:
|
||||
"salary_text": (pay_line(num(pay.get("minAmount")), num(pay.get("maxAmount")),
|
||||
pay.get("currencyIsoCode"), "")
|
||||
if p.get("isCompensationVisible") else ""),
|
||||
})
|
||||
}
|
||||
if employment := _employment(job):
|
||||
row["employment"] = employment
|
||||
out.append(row)
|
||||
return out
|
||||
Reference in new issue
Block a user