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
+64
-13
@@ -18,13 +18,24 @@ 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 Get, Row, parse_dt
|
||||
from ._contract import Ask, Fields, Place, Reads, Row
|
||||
from ._shared import Get, parse_dt
|
||||
|
||||
log = logging.getLogger(__name__)
|
||||
|
||||
READS = Reads(
|
||||
scope="board", listing="whole", text="detail", teaser=True, complete="whole",
|
||||
places="many",
|
||||
fields=Fields(posted="trusted", remote="stated", seniority="stated", employment="stated"),
|
||||
robots="read: robots.txt allows /jobs/companies/ (checked 2026-09-29)",
|
||||
)
|
||||
|
||||
NAME = "jobylon"
|
||||
LABEL = "Jobylon"
|
||||
@@ -47,6 +58,21 @@ _SLUG = re.compile(r"[0-9]{1,12}")
|
||||
#: from.
|
||||
_ROLE_PATH = re.compile(r"/jobs/[0-9]+(?:-[A-Za-z0-9_-]*)?/?")
|
||||
|
||||
#: The embed's `experience` -> `app.models.SENIORITIES`. Only the coarse levels
|
||||
#: are mapped; "Experienced" sits between "Mid level" and the managerial
|
||||
#: levels and says too little to place, so it stays unmapped and is logged.
|
||||
_SENIORITY = {"student": "intern", "internship": "intern", "trainee": "intern",
|
||||
"entry level": "junior", "entry-level": "junior", "junior": "junior",
|
||||
"graduate": "junior", "mid level": "mid", "mid-level": "mid", "mid": "mid",
|
||||
"senior": "senior", "lead": "lead", "manager": "manager", "director": "director",
|
||||
"executive": "exec", "not applicable": ""}
|
||||
|
||||
#: The embed's `employment_type` -> the app's employment words.
|
||||
_EMPLOYMENT = {"full-time": "full_time", "full time": "full_time", "part-time": "part_time",
|
||||
"part time": "part_time", "contract": "contract", "consultant": "contract",
|
||||
"temporary": "temporary", "internship": "intern", "intern": "intern",
|
||||
"freelance": "freelance", "summer job": "temporary", "seasonal": "temporary"}
|
||||
|
||||
_ASSIGNMENT = "JBL.embed_v2['jobs'] = "
|
||||
_KEY = re.compile(r"[A-Za-z_][A-Za-z0-9_]*")
|
||||
_TRAILING_COMMA = re.compile(r",(\s*[\]}])")
|
||||
@@ -74,17 +100,13 @@ def careers_url(slug: str) -> str:
|
||||
return f"https://{_EMP}/companies/{slug}/"
|
||||
|
||||
|
||||
def feed_url(slug: str) -> str:
|
||||
def feed_url(slug: str, ask: Ask) -> str:
|
||||
"""Both hosts serve the same robots.txt (compared on 2026-09-29), so the
|
||||
roles' pages on emp.jobylon.com are covered by what was checked for this
|
||||
one."""
|
||||
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."""
|
||||
@@ -157,6 +179,22 @@ def _published(value: Any) -> Any:
|
||||
return parse_dt(f"{match.group(3)}-{month:02d}-{int(match.group(2)):02d}")
|
||||
|
||||
|
||||
def _mapped(table: dict[str, str], value: Any, what: str) -> str | None:
|
||||
"""`table`'s word for the host's `value`; None when the host states none
|
||||
or the table does not know it (logged, so the table can grow)."""
|
||||
word = str(value or "").strip()
|
||||
if not word:
|
||||
return None
|
||||
found = table.get(word.lower())
|
||||
if found is None:
|
||||
log.debug("jobylon: unknown %s %r", what, word)
|
||||
return found or None
|
||||
|
||||
|
||||
def _place(text: str) -> Place:
|
||||
return {"text": text, "remote": True if re.search(r"\bremote\b", text, re.I) else None}
|
||||
|
||||
|
||||
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
|
||||
@@ -172,18 +210,30 @@ def parse(body: bytes, slug: str) -> list[Row]:
|
||||
if not title or not job_id or not _ROLE_PATH.fullmatch(path):
|
||||
continue
|
||||
function = str(j.get("function") or "").strip()
|
||||
out.append({
|
||||
places = [_place(name) for name in dict.fromkeys(
|
||||
str(name).strip() for name in j.get("locations") or [] if str(name).strip())]
|
||||
row: Row = {
|
||||
"source_id": job_id,
|
||||
"title": title,
|
||||
"location": "; ".join(dict.fromkeys(
|
||||
str(name).strip() for name in j.get("locations") or [] if str(name).strip())),
|
||||
"places": places,
|
||||
"location": "; ".join(pl["text"] for pl in places),
|
||||
"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
|
||||
})
|
||||
}
|
||||
# `summary` is the text the company gave the listing, the string
|
||||
# "None" when it gave none.
|
||||
summary = " ".join(html.unescape(strip_html(str(j.get("summary") or ""))).split())
|
||||
if summary and summary != "None":
|
||||
row["teaser"] = summary
|
||||
if seniority := _mapped(_SENIORITY, j.get("experience"), "experience"):
|
||||
row["seniority"] = seniority
|
||||
if employment := _mapped(_EMPLOYMENT, j.get("employment_type"), "employment_type"):
|
||||
row["employment"] = employment
|
||||
out.append(row)
|
||||
return out
|
||||
|
||||
|
||||
@@ -213,4 +263,5 @@ def detail(get: Get, slug: str, row: Row) -> dict[str, Any]:
|
||||
}
|
||||
if places:
|
||||
found["location"] = "; ".join(places)
|
||||
found["places"] = [_place(name) for name in places]
|
||||
return found
|
||||
Reference in new issue
Block a user