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>
This commit is contained in:
1 parent
4c0da58da7
commit
4316624769
42 files changed
+3126
-199
No files matched your search
@@ -35,7 +35,8 @@ country filter in this version.
|
||||
|
||||
A role's own page carries microdata (`itemtype` schema.org JobPosting) with
|
||||
`datePosted` and the address; `detail` reads the description, the date and the
|
||||
location with its country from it. Novo Nordisk's pages have none: the
|
||||
places with their country from it; a role at several places repeats the
|
||||
`jobLocation` block, once per place. Novo Nordisk's pages have none: the
|
||||
description is still in `itemprop="description"`, and the listing's date and
|
||||
location stand.
|
||||
"""
|
||||
@@ -51,6 +52,7 @@ from urllib.parse import urljoin, urlsplit
|
||||
|
||||
from desk.sources import strip_html
|
||||
|
||||
from ._contract import Ask, Fields, Place, Reads
|
||||
from ._shared import Get, Page, Row, is_web_url, only, parse_dt
|
||||
|
||||
NAME = "successfactors"
|
||||
@@ -75,6 +77,12 @@ PATTERNS = (
|
||||
# robots.txt rules that name it.
|
||||
KEEP_CASE = True
|
||||
|
||||
READS = Reads(
|
||||
scope="board", listing="paged", text="detail", complete="stated", places="many",
|
||||
fields=Fields(posted="trusted", country="stated"),
|
||||
robots="read: robots.txt allows /search/ and /job/ (checked 2026-09-29)",
|
||||
)
|
||||
|
||||
#: A public DNS name in lower case with a letter-only last label, so an address
|
||||
#: (`127.0.0.1`) or a single word (`localhost`) never names a site, and an
|
||||
#: optional prefix of one or more path segments. `ats._get` refuses the local
|
||||
@@ -182,10 +190,6 @@ def careers_url(slug: str) -> str:
|
||||
return f"https://{host}{prefix}/search/"
|
||||
|
||||
|
||||
def robots_page(slug: str) -> str:
|
||||
return careers_url(slug)
|
||||
|
||||
|
||||
def _search_url(slug: str, start: int) -> str:
|
||||
host, prefix = _parts(slug)
|
||||
return f"https://{host}{prefix}/search/?q=&locationsearch=&startrow={start}"
|
||||
@@ -291,7 +295,7 @@ def _entries(text: str) -> list[dict[str, Any]]:
|
||||
return out
|
||||
|
||||
|
||||
def page(get: Get, slug: str, cursor: Any) -> Page:
|
||||
def page(get: Get, slug: str, cursor: Any, ask: Ask = Ask()) -> Page:
|
||||
"""One search page. The cursor is `(start row, first role of the page
|
||||
before)`: the next start row is what this page returned, and a page that
|
||||
starts with the same role as the last one is the site ignoring `startrow`,
|
||||
@@ -329,6 +333,7 @@ def rows(decoded: str, slug: str) -> list[Row]:
|
||||
out.append({
|
||||
"source_id": entry["id"],
|
||||
"title": entry["title"],
|
||||
"places": [{"text": entry["place"], "remote": None}] if entry["place"] else [],
|
||||
"location": entry["place"],
|
||||
"url": url,
|
||||
"posted": _date(entry["date"]),
|
||||
@@ -368,6 +373,19 @@ def _posted(value: str) -> datetime | None:
|
||||
return parse_dt(value)
|
||||
|
||||
|
||||
def _country_code(meta: dict[str, str]) -> str:
|
||||
"""The address's country as an ISO code: `addressCountry`, or the code that
|
||||
`_place` reads in a `streetAddress`; '' for neither."""
|
||||
code = meta.get("addressCountry", "").strip().upper()
|
||||
if len(code) == 2:
|
||||
return code
|
||||
parts = [part.strip() for part in meta.get("streetAddress", "").split(",")]
|
||||
for i in range(len(parts) - 1, 0, -1):
|
||||
if len(parts) - i <= 2 and parts[i] in _COUNTRIES:
|
||||
return parts[i]
|
||||
return ""
|
||||
|
||||
|
||||
def _location(meta: dict[str, str]) -> str:
|
||||
"""The address as "City, Country". Vestas and Demant state
|
||||
`addressLocality` and `addressCountry` (a code), the other sites one
|
||||
@@ -386,7 +404,7 @@ def detail(get: Get, slug: str, row: Row) -> dict[str, Any]:
|
||||
"""A role's own page: `description` from the block marked
|
||||
`itemprop="description"`, which Novo Nordisk's pages have without the
|
||||
microdata around it, and, from a page that has the `JobPosting` microdata,
|
||||
`posted` (`datePosted`) and `location` with its country. A page that
|
||||
`posted` (`datePosted`) and every place with the country's code. A page that
|
||||
is not a role's (the site answers 200 for a closed one with its search) has
|
||||
no description block and gives an empty answer."""
|
||||
text = get(row["url"]).decode("utf-8", "replace")
|
||||
@@ -402,6 +420,25 @@ def detail(get: Get, slug: str, row: Row) -> dict[str, Any]:
|
||||
meta = {name: html.unescape(value) for name, value in _META.findall(text)}
|
||||
if posted := _posted(meta.get("datePosted", "")):
|
||||
out["posted"] = posted
|
||||
if place := _location(meta):
|
||||
out["location"] = place
|
||||
addresses = _addresses(text) or [meta]
|
||||
places: list[Place] = []
|
||||
for address in addresses:
|
||||
if (place := _location(address)) and place not in (p["text"] for p in places):
|
||||
places.append({"text": place, "remote": None})
|
||||
if places:
|
||||
out["places"] = places
|
||||
out["location"] = "; ".join(p["text"] for p in places)
|
||||
codes = {_country_code(address) for address in addresses}
|
||||
if len(codes) == 1 and (code := next(iter(codes))):
|
||||
out["country"] = code
|
||||
return out
|
||||
|
||||
|
||||
def _addresses(text: str) -> list[dict[str, str]]:
|
||||
"""The microdata of each `jobLocation` block, one dict of `itemprop` ->
|
||||
content per place. A role at several places repeats the block."""
|
||||
found = []
|
||||
for match in re.finditer(r'<(?:span|div)\b[^>]*\bitemprop="jobLocation"', text):
|
||||
block = _element(text, match.start())
|
||||
found.append({name: html.unescape(value) for name, value in _META.findall(block)})
|
||||
return found
|
||||
Reference in new issue
Block a user