Merge branch 'wp6-json-hosts'
This commit is contained in:
commit
0eff7c9d13
20 files changed
+2221
No files matched your search
@@ -0,0 +1,135 @@
|
||||
"""BambooHR: `bamboohr:<subdomain>` for acme.bamboohr.com, the whole board in
|
||||
one JSON answer and each role's text, date and country on its own page.
|
||||
|
||||
Written from Configit's board on 2026-09-29 (two roles); jobhunt-hq did not
|
||||
read BambooHR. Unverified: whether a large board pages `/careers/list` (this
|
||||
one states `meta.totalCount` and no paging keys, so a list shorter than its
|
||||
count is refused rather than read as the whole board), and the words of
|
||||
`locationType`, taken to be BambooHR's own settings, "0" in the office, "1"
|
||||
remote and "2" hybrid; Configit's hybrid roles say "2" and `isRemote` is null.
|
||||
|
||||
A posting that invites an unsolicited application without a role (Configit's
|
||||
first) is listed like any other role.
|
||||
"""
|
||||
|
||||
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, Row, label_slug_ok, only, parse_dt
|
||||
|
||||
NAME = "bamboohr"
|
||||
LABEL = "BambooHR"
|
||||
PATTERNS = (
|
||||
# Not the company's own app or documentation subdomains, which BambooHR
|
||||
# itself serves and which name no board.
|
||||
r"https?://(?!(?:app|resources|documentation|help)\.)([a-z0-9-]+)\.bamboohr\.com",
|
||||
)
|
||||
|
||||
#: `locationType` -> `store._remote`'s words. Anything else says nothing.
|
||||
_REMOTE = {"0": "onsite", "1": "remote", "2": "hybrid"}
|
||||
|
||||
#: Sent on the detail read: without it the same URL answers the page's HTML.
|
||||
_JSON = {"Accept": "application/json"}
|
||||
|
||||
|
||||
def host(slug: str) -> str:
|
||||
return f"{slug.lower()}.bamboohr.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)}/careers"
|
||||
|
||||
|
||||
def robots_page(slug: str) -> str:
|
||||
return careers_url(slug)
|
||||
|
||||
|
||||
def feed_url(slug: str) -> str:
|
||||
return f"https://{host(slug)}/careers/list"
|
||||
|
||||
|
||||
def _remote(j: dict[str, Any]) -> str | None:
|
||||
if j.get("isRemote") is True:
|
||||
return "remote"
|
||||
return _REMOTE.get(str(j.get("locationType") if j.get("locationType") is not None else ""))
|
||||
|
||||
|
||||
def _place(j: dict[str, Any]) -> str:
|
||||
"""City, state and country of a role, as far as either of its two
|
||||
location objects states them (`atsLocation` mirrors `location` and is
|
||||
filled by companies that use BambooHR's own applicant tracking)."""
|
||||
place, ats_place = j.get("location") or {}, j.get("atsLocation") or {}
|
||||
country = place.get("addressCountry") or ats_place.get("country")
|
||||
parts = (place.get("city") or ats_place.get("city"),
|
||||
place.get("state") or ats_place.get("state"), country)
|
||||
return ", ".join(str(p).strip() for p in parts if p and str(p).strip())
|
||||
|
||||
|
||||
def parse(body: bytes, slug: str) -> list[Row]:
|
||||
"""`/careers/list` -> `{"meta": {"totalCount": n}, "result": [...]}`. A
|
||||
role has `id`, `jobOpeningName`, `departmentLabel`, `location` (`city`,
|
||||
`state`), `atsLocation` (the same with a `country`, null so far),
|
||||
`isRemote` and `locationType`. The text, the date and the country are only
|
||||
on the role's own page (`detail`), which is why `description` and `posted`
|
||||
are empty here."""
|
||||
data = json.loads(body)
|
||||
listed = data.get("result") if isinstance(data, dict) else None
|
||||
if not isinstance(listed, list):
|
||||
raise ValueError("not a BambooHR listing: no result list")
|
||||
stated = (data.get("meta") or {}).get("totalCount")
|
||||
if isinstance(stated, int) and stated > len(listed):
|
||||
raise ValueError(f"BambooHR listing has {len(listed)} of {stated} roles")
|
||||
out = []
|
||||
for j in listed:
|
||||
title = (j.get("jobOpeningName") or "").strip()
|
||||
source_id = str(j.get("id") or "")
|
||||
if not title or not source_id:
|
||||
continue
|
||||
out.append({
|
||||
"source_id": source_id,
|
||||
"title": title,
|
||||
"location": _place(j),
|
||||
"url": f"https://{host(slug)}/careers/{source_id}",
|
||||
"posted": None,
|
||||
"department": str(j.get("departmentLabel") or "").strip(),
|
||||
"description": "",
|
||||
"remote": _remote(j),
|
||||
"salary_text": "", # the list states no pay; the detail's `compensation` was null
|
||||
})
|
||||
return out
|
||||
|
||||
|
||||
def detail(get: Get, slug: str, row: Row) -> dict[str, Any]:
|
||||
"""`/careers/<id>/detail` -> `{"result": {"jobOpening": {...}}}`, with the
|
||||
HTML `description`, `datePosted` (a date), `location` (`city`, `state`,
|
||||
`addressCountry`) and `locationType`. The location is the listing's with
|
||||
the country added, since the listing has none."""
|
||||
data = json.loads(get(f"https://{host(slug)}/careers/{row['source_id']}/detail",
|
||||
headers=_JSON))
|
||||
opening = ((data.get("result") or {}).get("jobOpening")
|
||||
if isinstance(data, dict) else None)
|
||||
if not isinstance(opening, dict):
|
||||
raise ValueError("not a BambooHR role: no result.jobOpening")
|
||||
out: dict[str, Any] = {
|
||||
"description": " ".join(html.unescape(strip_html(opening.get("description") or "")).split()),
|
||||
"posted": parse_dt(opening.get("datePosted")),
|
||||
}
|
||||
if place := _place(opening):
|
||||
out["location"] = place
|
||||
if remote := _remote(opening):
|
||||
out["remote"] = remote
|
||||
return out
|
||||
@@ -0,0 +1,169 @@
|
||||
"""Eightfold: `eightfold:<tenant host>/<domain>`, for example
|
||||
`eightfold:infineon.eightfold.ai/infineon.com` or, for a career site on the
|
||||
company's own host, `eightfold:jobs.ericsson.com/ericsson.com`. The public
|
||||
PCSX search, paged by offset at ten roles a page with the total stated, and a
|
||||
role's text on its own request.
|
||||
|
||||
Written from Ericsson's site on 2026-09-29 (637 roles), with Infineon's and
|
||||
Microsoft's read the same day in the findings. Unverified on a tenant other
|
||||
than those three: that the search takes the same parameters and answers with
|
||||
the same fields.
|
||||
|
||||
The `domain` is the tenant's own name for the company, usually the company's
|
||||
domain, and it is not the host: the site's page carries it as `domain=` in its
|
||||
links. `/api/apply/v2/jobs` answers 403 "Not authorized for PCSX" on the sites
|
||||
tried, so it is not used.
|
||||
|
||||
The search ignores `num` and answers ten roles a page, so a board costs one
|
||||
request per ten roles, and `ats.MAX_PAGES` (100) stops a read at 1,000 roles: a
|
||||
larger board (Infineon's 1,292, Microsoft's 2,319) is read incomplete every pull,
|
||||
and an incomplete read never closes the roles it did not list. The rows are
|
||||
sorted newest first (`sort_by=timestamp`) so that what the cap keeps is the
|
||||
newest thousand and the pages do not shuffle between two requests, unlike the
|
||||
default order, which puts hot roles first. The search does take a `location`
|
||||
free text (Ericsson's "Sweden" found 157 of 637), which could bring a read
|
||||
under the cap, but a target names no filter and none is built here.
|
||||
|
||||
Discovery names Eightfold from an `eightfold.ai` link, and the host and the
|
||||
domain from one that carries `domain=`.
|
||||
"""
|
||||
|
||||
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, Page, Row, is_web_url, only, parse_dt
|
||||
|
||||
NAME = "eightfold"
|
||||
LABEL = "Eightfold"
|
||||
PATTERNS = (
|
||||
# Both parts, from a link to a tenant's site that says its domain.
|
||||
r"https?://([a-z0-9-]+\.eightfold\.ai)/[^\s\"'<>]*?[?&]domain=([a-z0-9.-]+\.[a-z]{2,})",
|
||||
# No slug: a link to a tenant's site that does not.
|
||||
r"[a-z0-9-]+\.eightfold\.ai",
|
||||
)
|
||||
|
||||
#: A whole host name: two labels or more, the last one letters, so neither an
|
||||
#: address, a bare word nor a port names a site. `ats._get` refuses every host
|
||||
#: but the tenant's, redirects included.
|
||||
_NAME = re.compile(r"[a-z0-9]([a-z0-9-]*[a-z0-9])?(\.[a-z0-9]([a-z0-9-]*[a-z0-9])?)*\.[a-z]{2,}")
|
||||
|
||||
#: Names a private network uses, never a company's career site.
|
||||
_LOCAL = (".localhost", ".local", ".internal", ".lan", ".home.arpa")
|
||||
|
||||
#: `workLocationOption` -> `store._remote`'s words. Only "onsite" and "hybrid"
|
||||
#: were seen; the other spellings are the obvious ones.
|
||||
_REMOTE = {"onsite": "onsite", "on_site": "onsite", "hybrid": "hybrid", "remote": "remote"}
|
||||
|
||||
|
||||
def parts(slug: str) -> tuple[str, str]:
|
||||
"""`(host, domain)` of a slug, lowercased."""
|
||||
host, _, domain = slug.lower().partition("/")
|
||||
return host, domain
|
||||
|
||||
|
||||
def _name_ok(name: str) -> bool:
|
||||
return bool(_NAME.fullmatch(name)) and not name.endswith(_LOCAL)
|
||||
|
||||
|
||||
def slug_ok(slug: str) -> bool:
|
||||
host, sep, domain = slug.lower().partition("/")
|
||||
return bool(sep) and _name_ok(host) and _name_ok(domain)
|
||||
|
||||
|
||||
def allowed(slug: str) -> Callable[[str], bool]:
|
||||
return only(parts(slug)[0])
|
||||
|
||||
|
||||
def careers_url(slug: str) -> str:
|
||||
return f"https://{parts(slug)[0]}/careers"
|
||||
|
||||
|
||||
def robots_page(slug: str) -> str:
|
||||
return careers_url(slug)
|
||||
|
||||
|
||||
def page(get: Get, slug: str, cursor: Any) -> Page:
|
||||
"""One page of `/api/pcsx/search` -> `{"status": 200, "data": {"positions":
|
||||
[...], "count": n}}`; the next starts at the offset after this page's
|
||||
positions, and an empty page ends the read."""
|
||||
host, domain = parts(slug)
|
||||
start = int(cursor or 0)
|
||||
answer = json.loads(get(f"https://{host}/api/pcsx/search?domain={domain}"
|
||||
f"&sort_by=timestamp&start={start}"))
|
||||
data = answer.get("data") if isinstance(answer, dict) else None
|
||||
positions = data.get("positions") if isinstance(data, dict) else None
|
||||
if not isinstance(positions, list):
|
||||
raise ValueError("not an Eightfold search answer: no data.positions"
|
||||
+ (f" (status {answer.get('status')})" if isinstance(answer, dict) else ""))
|
||||
count = data.get("count")
|
||||
results = [{"id": str(p.get("id") or "")} for p in positions]
|
||||
return (positions, results, count if isinstance(count, int) else None,
|
||||
start + len(positions) if positions else None)
|
||||
|
||||
|
||||
def _place(locations: Any) -> str:
|
||||
"""The role's places, "; " apart. Eightfold writes each as "city,region,
|
||||
country" with no space and repeats the name when a city is its own region
|
||||
("Mexico City,Mexico City,Mexico"), so the repeats go."""
|
||||
out: list[str] = []
|
||||
for loc in locations if isinstance(locations, list) else []:
|
||||
names: list[str] = []
|
||||
for name in str(loc).split(","):
|
||||
name = name.strip()
|
||||
if name and name not in names:
|
||||
names.append(name)
|
||||
if names and ", ".join(names) not in out:
|
||||
out.append(", ".join(names))
|
||||
return "; ".join(out)
|
||||
|
||||
|
||||
def rows(positions: list[dict[str, Any]], slug: str) -> list[Row]:
|
||||
"""A position has `id` (a number, kept as a string), `displayJobId`,
|
||||
`name`, `locations`, `postedTs` (epoch seconds), `department`,
|
||||
`workLocationOption` and `positionUrl`, the path of the role's page on the
|
||||
tenant's host. The list has no text, and no pay is stated anywhere."""
|
||||
host = parts(slug)[0]
|
||||
out = []
|
||||
for p in positions:
|
||||
title = (p.get("name") or "").strip()
|
||||
source_id = str(p.get("id") or "")
|
||||
path = str(p.get("positionUrl") or "").strip()
|
||||
url = f"https://{host}{path}" if path.startswith("/") and path[1:2] != "/" else ""
|
||||
if not title or not source_id or not is_web_url(url):
|
||||
continue
|
||||
out.append({
|
||||
"source_id": source_id,
|
||||
"title": title,
|
||||
"location": _place(p.get("locations") or p.get("standardizedLocations")),
|
||||
"url": url,
|
||||
"posted": parse_dt(p.get("postedTs")),
|
||||
"department": str(p.get("department") or "").strip(),
|
||||
"description": "",
|
||||
"remote": _REMOTE.get(str(p.get("workLocationOption") or "").strip().lower()),
|
||||
"salary_text": "",
|
||||
})
|
||||
return out
|
||||
|
||||
|
||||
def detail(get: Get, slug: str, row: Row) -> dict[str, Any]:
|
||||
"""`/api/pcsx/position_details` of the role -> `data.jobDescription`, the
|
||||
HTML text of the ad. The same answer repeats the listing's fields, and
|
||||
`publicUrl`, none of which is needed."""
|
||||
host, domain = parts(slug)
|
||||
role = str(row["source_id"])
|
||||
if not role.isdigit():
|
||||
raise ValueError(f"not an Eightfold position id: {role!r}")
|
||||
answer = json.loads(get(f"https://{host}/api/pcsx/position_details"
|
||||
f"?position_id={role}&domain={domain}&hl=en"))
|
||||
data = answer.get("data") if isinstance(answer, dict) else None
|
||||
if not isinstance(data, dict) or "jobDescription" not in data:
|
||||
raise ValueError("not an Eightfold position: no data.jobDescription")
|
||||
text = html.unescape(strip_html(data["jobDescription"] or ""))
|
||||
return {"description": " ".join(text.split())}
|
||||
@@ -0,0 +1,152 @@
|
||||
"""Gem: `gem:<board>` for jobs.gem.com/<board>, one GraphQL POST for the
|
||||
whole board and one more for a role's text and date. The board is the path
|
||||
after `jobs.gem.com/`, and it is case-sensitive (`Productboard` is an empty
|
||||
board where `productboard` is not).
|
||||
|
||||
The two queries below were read out of Gem's page scripts
|
||||
(`static.gem.com/scripts/jobBoards.*.js` and `ExternalJobBoardList.*.js`) on
|
||||
2026-09-29 and run against Productboard's and sennder's boards; the schema is
|
||||
Gem's own and not documented, so a new bundle can rename a field. Each query is
|
||||
one constant, and an answer that lacks the shape read here fails with an error
|
||||
that says which part is missing rather than reading as an empty board. The
|
||||
endpoint answered with no Origin and no Referer header, so none is sent. An
|
||||
unknown board answers 200 with an empty list, like a board with no role open.
|
||||
|
||||
The listing has no description and no date; both are on 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 Get, Page, Row, only, parse_dt
|
||||
|
||||
NAME = "gem"
|
||||
LABEL = "Gem"
|
||||
KEEP_CASE = True
|
||||
PATTERNS = (r"jobs\.gem\.com/([A-Za-z0-9_-]+)",)
|
||||
|
||||
_HOST = "jobs.gem.com"
|
||||
_API = f"https://{_HOST}/api/public/graphql"
|
||||
|
||||
#: A board is one path segment of letters, digits, `-` and `_`. It travels as a
|
||||
#: GraphQL variable and never into a host name, so the host stays Gem's.
|
||||
_BOARD = re.compile(r"[A-Za-z0-9_-]+")
|
||||
|
||||
#: Every role of a board in one answer, with no paging and no total.
|
||||
LIST_QUERY = (
|
||||
"query JobBoardList($boardId: String!) { oatsExternalJobPostings(boardId: $boardId) "
|
||||
"{ jobPostings { id extId title locations { id name city isoCountry isRemote extId } "
|
||||
"job { id department { id name extId } locationType employmentType } } } }")
|
||||
|
||||
#: One role's description and the date it was first published.
|
||||
DETAIL_QUERY = (
|
||||
"query ExternalJobPosting($boardId: String!, $extId: String!) "
|
||||
"{ oatsExternalJobPosting(boardId: $boardId, extId: $extId) "
|
||||
"{ id title descriptionHtml extId firstPublishedTsSec "
|
||||
"locations { id extId name city isoCountry isRemote } "
|
||||
"job { id locationType employmentType requisitionId teamDisplayName "
|
||||
"department { id extId name } } compensationHtml } }")
|
||||
|
||||
#: `job.locationType` -> `store._remote`'s words.
|
||||
_REMOTE = {"IN_OFFICE": "onsite", "HYBRID": "hybrid", "REMOTE": "remote"}
|
||||
|
||||
|
||||
def slug_ok(slug: str) -> bool:
|
||||
return bool(_BOARD.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 _ask(get: Get, operation: str, query: str, variables: dict[str, str],
|
||||
path: str) -> Any:
|
||||
"""One GraphQL call, and the part of its answer at `data.<path>`. An
|
||||
`errors` list or a `data` without the key is Gem's schema having moved (or
|
||||
a refused query), and is raised as such; a `null` at the key is returned."""
|
||||
answer = json.loads(get(_API, method="POST", payload={
|
||||
"operationName": operation, "variables": variables, "query": query}))
|
||||
if not isinstance(answer, dict):
|
||||
raise ValueError(f"not a Gem answer: {type(answer).__name__}")
|
||||
if answer.get("errors"):
|
||||
first = answer["errors"][0]
|
||||
message = first.get("message") if isinstance(first, dict) else first
|
||||
raise ValueError(f"Gem's {operation} query was refused: {message}")
|
||||
data = answer.get("data")
|
||||
if not isinstance(data, dict) or path not in data:
|
||||
raise ValueError(f"Gem's {operation} answer has no {path}; the query may be out of date")
|
||||
return data[path]
|
||||
|
||||
|
||||
def page(get: Get, slug: str, cursor: Any) -> Page:
|
||||
"""The one page there is: `data.oatsExternalJobPostings.jobPostings`."""
|
||||
board = _ask(get, "JobBoardList", LIST_QUERY, {"boardId": slug}, "oatsExternalJobPostings")
|
||||
postings = board.get("jobPostings") if isinstance(board, dict) else None
|
||||
if not isinstance(postings, list):
|
||||
raise ValueError("Gem's JobBoardList answer has no jobPostings list; "
|
||||
"the query may be out of date")
|
||||
return postings, [{"id": p.get("extId") or p.get("id") or ""} for p in postings], None, None
|
||||
|
||||
|
||||
def rows(postings: list[dict[str, Any]], slug: str) -> list[Row]:
|
||||
"""A role has `extId` (a number from a synced Greenhouse, else an opaque
|
||||
string; the role's page is `jobs.gem.com/<board>/<extId>`), `title`,
|
||||
`locations` (`name`, `city`, `isoCountry` as ISO alpha-3, `isRemote`) and
|
||||
`job` (`department`, `locationType`, `employmentType`). No pay is stated
|
||||
in the list."""
|
||||
out = []
|
||||
for p in postings:
|
||||
title = (p.get("title") or "").strip()
|
||||
ext_id = str(p.get("extId") or "")
|
||||
if not title or not ext_id:
|
||||
continue
|
||||
locations = p.get("locations") or []
|
||||
places: list[str] = []
|
||||
for loc in locations:
|
||||
place = str(loc.get("city") or loc.get("name") or "").strip()
|
||||
if place and place not in places:
|
||||
places.append(place)
|
||||
job = p.get("job") or {}
|
||||
remote = _REMOTE.get(str(job.get("locationType") or "").upper())
|
||||
if remote is None and locations and all(loc.get("isRemote") for loc in locations):
|
||||
remote = "remote"
|
||||
out.append({
|
||||
"source_id": ext_id,
|
||||
"title": title,
|
||||
"location": "; ".join(places),
|
||||
"url": f"{careers_url(slug)}/{ext_id}",
|
||||
"posted": None, # only the role's own query has a date
|
||||
"department": str((job.get("department") or {}).get("name") or "").strip(),
|
||||
"description": "",
|
||||
"remote": remote,
|
||||
"salary_text": "",
|
||||
})
|
||||
return out
|
||||
|
||||
|
||||
def detail(get: Get, slug: str, row: Row) -> dict[str, Any]:
|
||||
"""`oatsExternalJobPosting` of the role: `descriptionHtml` and
|
||||
`firstPublishedTsSec` (epoch seconds). `compensationHtml` was null on the
|
||||
roles read and is left alone."""
|
||||
role = _ask(get, "ExternalJobPosting", DETAIL_QUERY,
|
||||
{"boardId": slug, "extId": row["source_id"]}, "oatsExternalJobPosting")
|
||||
if not isinstance(role, dict):
|
||||
raise ValueError(f"Gem has no role {row['source_id']} on {slug}")
|
||||
text = html.unescape(strip_html(role.get("descriptionHtml") or ""))
|
||||
return {"description": " ".join(text.split()),
|
||||
"posted": parse_dt(role.get("firstPublishedTsSec"))}
|
||||
@@ -0,0 +1,132 @@
|
||||
"""Jibe (iCIMS Jibe): `jibe:<host>`, the career site's own host name, for
|
||||
example `jibe:jobs.booking.com`. A JSON API on that host, paged by page number
|
||||
at 100 roles a page, with the total stated.
|
||||
|
||||
Written from Booking.com's site on 2026-09-29 (145 roles, two pages), the only
|
||||
Jibe site read. Unverified: that another Jibe site serves `/api/jobs` with the
|
||||
same parameters and answer, and what one that does not gives. A host that is
|
||||
not a Jibe site fails as a board that is not a listing.
|
||||
|
||||
`GET /api/jobs?limit=100&page=N` answers `{"jobs": [{"data": {...}}], "totalCount"}`
|
||||
with each role's full description, so the roles need no `detail`; `limit=200` is
|
||||
a 422. The findings used `brand=Booking.com`, which is not needed: without it
|
||||
the site's whole board is read, 145 roles, of which the filter keeps the 97 of
|
||||
brand "Booking.com" and drops the 48 of brand "Booking Holdings", the parent's
|
||||
own roles (finance, legal and data teams in Bucharest, listed and applied for
|
||||
on the same site). The board is read whole, as the site shows it, and `brand`
|
||||
is not in the target.
|
||||
|
||||
A role's page is `/jobs/<slug>` on the host, which redirects to the site's own
|
||||
path (`/booking/jobs/<slug>` on Booking's), so no site's path prefix is built
|
||||
in. The site's robots.txt asks for `crawl-delay: 5`, which the shared reader
|
||||
does not honour (`ats.PAGE_DELAY` is 0.5 s); a board is two requests.
|
||||
|
||||
Discovery can name Jibe (a site loads its assets from `jibecdn.com` or applies
|
||||
on `jibeapply.com`) but not the host, since a Jibe site's own links look like
|
||||
any other site's, so the host is given by hand.
|
||||
"""
|
||||
|
||||
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, Page, Row, only, parse_dt
|
||||
|
||||
NAME = "jibe"
|
||||
LABEL = "Jibe"
|
||||
PATTERNS = (
|
||||
# No slug: the host is the company's own, which no URL on the page names.
|
||||
r"jibeapply\.com|jibecdn\.com/prod",
|
||||
)
|
||||
|
||||
#: The page size asked for, which is also the most the host serves (200 is a 422).
|
||||
PAGE_SIZE = 100
|
||||
|
||||
#: A whole host name (two labels or more, the last one letters), so neither an
|
||||
#: address (`127.0.0.1`), a bare word (`localhost`) nor a port names a site.
|
||||
#: `ats._get` refuses every host but this one, redirects included, and a local
|
||||
#: name or an address in any case.
|
||||
_HOST = re.compile(r"[a-z0-9]([a-z0-9-]*[a-z0-9])?(\.[a-z0-9]([a-z0-9-]*[a-z0-9])?)*\.[a-z]{2,}")
|
||||
|
||||
|
||||
#: Names a private network uses, never a company's career site; `ats._get`
|
||||
#: refuses them too, and a slug that names one is not a board at all.
|
||||
_LOCAL = (".localhost", ".local", ".internal", ".lan", ".home.arpa")
|
||||
|
||||
|
||||
def slug_ok(slug: str) -> bool:
|
||||
host = slug.lower()
|
||||
return bool(_HOST.fullmatch(host)) and not host.endswith(_LOCAL)
|
||||
|
||||
|
||||
def allowed(slug: str) -> Callable[[str], bool]:
|
||||
return only(slug)
|
||||
|
||||
|
||||
def careers_url(slug: str) -> str:
|
||||
return f"https://{slug.lower()}/jobs"
|
||||
|
||||
|
||||
def robots_page(slug: str) -> str:
|
||||
return careers_url(slug)
|
||||
|
||||
|
||||
def page(get: Get, slug: str, cursor: Any) -> Page:
|
||||
"""One page of `/api/jobs`; the next is the following number, and an empty
|
||||
page ends the read."""
|
||||
number = int(cursor or 1)
|
||||
data = json.loads(get(f"https://{slug.lower()}/api/jobs?limit={PAGE_SIZE}&page={number}"))
|
||||
jobs = data.get("jobs") if isinstance(data, dict) else None
|
||||
if not isinstance(jobs, list):
|
||||
raise ValueError("not a Jibe listing: no jobs list")
|
||||
total = data.get("totalCount")
|
||||
results = [{"id": (j.get("data") or {}).get("slug") or ""} for j in jobs]
|
||||
return data, results, total if isinstance(total, int) else None, \
|
||||
number + 1 if jobs else None
|
||||
|
||||
|
||||
def parse(body: bytes, slug: str) -> list[Row]:
|
||||
return rows(json.loads(body), slug)
|
||||
|
||||
|
||||
def _plain(markup: Any) -> str:
|
||||
return " ".join(html.unescape(strip_html(str(markup or ""))).split())
|
||||
|
||||
|
||||
def rows(data: dict[str, Any], slug: str) -> list[Row]:
|
||||
"""One page: each `jobs[].data` has `slug` (equal to `req_id`), `title`,
|
||||
the HTML `description` and, on some, `qualifications`, `full_location`
|
||||
("Amsterdam, Netherlands; Manchester, United Kingdom" for several),
|
||||
`city` and `country`, `categories`, `posted_date` and `apply_url`, on the
|
||||
iCIMS site. The `salary_*` fields were 0 on every role and there is no
|
||||
currency, so no pay is read; nothing says remote (`location_type` is a
|
||||
kind of coordinates)."""
|
||||
out = []
|
||||
for job in data.get("jobs") or []:
|
||||
j = job.get("data") or {}
|
||||
title = (j.get("title") or "").strip()
|
||||
role = str(j.get("slug") or j.get("req_id") or "")
|
||||
if not title or not role:
|
||||
continue
|
||||
categories = j.get("categories") or []
|
||||
text = "\n\n".join(p for p in (_plain(j.get("description")),
|
||||
_plain(j.get("qualifications"))) if p)
|
||||
out.append({
|
||||
"source_id": role,
|
||||
"title": title,
|
||||
"location": (j.get("full_location")
|
||||
or ", ".join(p for p in (j.get("city"), j.get("country")) if p)).strip(),
|
||||
"url": f"https://{slug.lower()}/jobs/{role}",
|
||||
"posted": parse_dt(j.get("posted_date")),
|
||||
"department": str((categories[0] if categories else {}).get("name") or "").strip(),
|
||||
"description": text,
|
||||
"remote": None,
|
||||
"salary_text": "",
|
||||
})
|
||||
return out
|
||||
@@ -0,0 +1,149 @@
|
||||
"""Pinpoint: `pinpoint:<subdomain>` for acme.pinpointhq.com, the whole board
|
||||
in one JSON answer. There is no probe: an unknown subdomain's answer was not
|
||||
checked, and a board is found by the link a career site carries.
|
||||
|
||||
Written from Xeneta's board on 2026-09-29 (two roles); jobhunt-hq did not read
|
||||
Pinpoint. Unverified: whether a large board pages `/postings.json` (the answer
|
||||
has a `data` list and no paging keys, so every board is read as complete
|
||||
here), and the spelling of `compensation_frequency`, since no board read so far
|
||||
shows its pay (`compensation_visible` was false on both roles). A board shared
|
||||
by several brands (inMusic's, with Native Instruments on it) is read whole;
|
||||
there is no filter on `job.division`.
|
||||
|
||||
There is no posted date in the listing, only in each posting's page as JSON-LD,
|
||||
so `posted` stays None rather than costing a request a role for it.
|
||||
"""
|
||||
|
||||
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 Row, is_web_url, label_slug_ok, num, only, pay_line, yearly_amount
|
||||
|
||||
NAME = "pinpoint"
|
||||
LABEL = "Pinpoint"
|
||||
PATTERNS = (r"https?://([a-z0-9-]+)\.pinpointhq\.com",)
|
||||
|
||||
#: `workplace_type` -> `store._remote`'s words. Anything else says nothing.
|
||||
_REMOTE = {"onsite": "onsite", "on_site": "onsite", "hybrid": "hybrid", "remote": "remote"}
|
||||
|
||||
#: `compensation_frequency` -> the multiplier that makes a figure yearly. The
|
||||
#: spellings are a guess, since no board read so far states pay; a frequency
|
||||
#: not listed leaves the yearly columns empty, and `salary_text` still says it.
|
||||
_YEARLY = {"annually": 1, "annual": 1, "yearly": 1, "year": 1, "monthly": 12, "month": 12}
|
||||
|
||||
#: `compensation_frequency` -> the word `salary_text` says after "per".
|
||||
_PERIOD = {"annually": "year", "annual": "year", "yearly": "year", "monthly": "month",
|
||||
"weekly": "week", "daily": "day", "hourly": "hour"}
|
||||
|
||||
#: The sections of a posting's text, in the order the page shows them: the
|
||||
#: description, then these fields, each with its own heading in `<field>_header`.
|
||||
_SECTIONS = ("key_responsibilities", "skills_knowledge_expertise", "benefits")
|
||||
|
||||
|
||||
def host(slug: str) -> str:
|
||||
return f"{slug.lower()}.pinpointhq.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 feed_url(slug: str) -> str:
|
||||
return f"https://{host(slug)}/postings.json"
|
||||
|
||||
|
||||
def _plain(markup: Any) -> str:
|
||||
"""HTML as one line of plain text: the tags out, the entities read (Pinpoint
|
||||
writes `&` and ` `), the whitespace, non-breaking included, collapsed."""
|
||||
return " ".join(html.unescape(strip_html(str(markup or ""))).split())
|
||||
|
||||
|
||||
def _text(j: dict[str, Any]) -> str:
|
||||
"""The description and the sections after it, each section under its own
|
||||
heading, as plain text with a blank line between them."""
|
||||
parts = [_plain(j.get("description"))]
|
||||
for field in _SECTIONS:
|
||||
body = _plain(j.get(field))
|
||||
if body:
|
||||
heading = str(j.get(f"{field}_header") or "").strip()
|
||||
parts.append(f"{heading}: {body}" if heading else body)
|
||||
return "\n\n".join(p for p in parts if p)
|
||||
|
||||
|
||||
def _place(location: dict[str, Any]) -> str:
|
||||
"""The place's name, then its `province` where that says more. Pinpoint
|
||||
fills `province` with a region or a country as the company typed it, so it
|
||||
is kept only when it differs from the name."""
|
||||
parts: list[str] = []
|
||||
for part in (location.get("name") or location.get("city"), location.get("province")):
|
||||
part = str(part or "").strip()
|
||||
if part and part.lower() not in (p.lower() for p in parts):
|
||||
parts.append(part)
|
||||
return ", ".join(parts)
|
||||
|
||||
|
||||
def _pay(j: dict[str, Any]) -> tuple[int | None, int | None, str, str]:
|
||||
"""`(salary_min, salary_max, currency, salary_text)` of a posting whose
|
||||
pay is shown (`compensation_visible`); the free-text `compensation` is the
|
||||
line when the bounds are not given."""
|
||||
if not j.get("compensation_visible"):
|
||||
return None, None, "", ""
|
||||
lo, hi = num(j.get("compensation_minimum")), num(j.get("compensation_maximum"))
|
||||
frequency = str(j.get("compensation_frequency") or "").strip().lower()
|
||||
period = _PERIOD.get(frequency, frequency)
|
||||
text = pay_line(lo, hi, j.get("compensation_currency"), period)
|
||||
text = text or str(j.get("compensation") or "").strip()
|
||||
low, high, code = yearly_amount(lo, hi, j.get("compensation_currency"), frequency, _YEARLY)
|
||||
return low, high, code, text
|
||||
|
||||
|
||||
def parse(body: bytes, slug: str) -> list[Row]:
|
||||
"""`{slug}.pinpointhq.com/postings.json` -> `{"data": [...]}`. A posting has
|
||||
`id`, `title`, `url`, `location` (`name`, `city`, `province`),
|
||||
`workplace_type`, `job` (`requisition_id`, `department`, `division`), the
|
||||
HTML `description` and its sections, and the `compensation_*` fields."""
|
||||
data = json.loads(body)
|
||||
if not isinstance(data, dict) or not isinstance(data.get("data"), list):
|
||||
raise ValueError("not a Pinpoint listing: no data list")
|
||||
out = []
|
||||
for j in data["data"]:
|
||||
title = (j.get("title") or "").strip()
|
||||
url = (j.get("url") or "").strip()
|
||||
source_id = str(j.get("id") or "")
|
||||
if not title or not source_id or not is_web_url(url):
|
||||
continue
|
||||
job = j.get("job") or {}
|
||||
low, high, currency, salary_text = _pay(j)
|
||||
out.append({
|
||||
"source_id": source_id,
|
||||
"title": title,
|
||||
"location": _place(j.get("location") or {}),
|
||||
"url": url,
|
||||
"posted": None, # only the posting's own page has a date
|
||||
"department": str((job.get("department") or {}).get("name") or "").strip(),
|
||||
"description": _text(j),
|
||||
"remote": _REMOTE.get(str(j.get("workplace_type") or "").strip().lower()),
|
||||
"salary_text": salary_text,
|
||||
"salary_min": low,
|
||||
"salary_max": high,
|
||||
"currency": currency,
|
||||
})
|
||||
return out
|
||||
Reference in new issue
Block a user