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>
149 lines
6.0 KiB
Python
149 lines
6.0 KiB
Python
"""Teamtailor: `teamtailor:<subdomain>` for acme.teamtailor.com, or, for a
|
|
career site on the company's own domain, that whole host name:
|
|
`teamtailor:careers.acme.com`. An RSS feed paged by offset that states no
|
|
total.
|
|
|
|
Written from live feeds on 2026-09-29; jobhunt-hq did not read Teamtailor.
|
|
"""
|
|
|
|
from __future__ import annotations
|
|
|
|
import html
|
|
import re
|
|
import xml.etree.ElementTree as ET
|
|
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 Get, Page, Row, is_web_url, only, parse_dt
|
|
|
|
NAME = "teamtailor"
|
|
LABEL = "Teamtailor"
|
|
RANK = 80
|
|
PATTERNS = (
|
|
r"https?://([a-z0-9-]+)\.teamtailor\.com",
|
|
# No slug: a career site on the company's own domain, which only loads
|
|
# Teamtailor's CDN. Discovery reads its board off the page's host.
|
|
r"cdn\.teamtailor\.com|teamtailor-cdn|teamtailor\.com/assets",
|
|
)
|
|
|
|
READS = Reads(
|
|
scope="board", listing="paged", page_size=50, text="listing", complete="end",
|
|
places="many", fields=Fields(posted="trusted", remote="stated"),
|
|
robots="api: no robots.txt check needed (public board API), 2026-09-30",
|
|
)
|
|
|
|
#: The page size, asked for as `per_page`. A feed with neither parameter
|
|
#: answers with every role (73 of 73 at Shine, 2026-09-29), but says nowhere
|
|
#: that it is the whole list, so this reads by page to an empty one;
|
|
#: `per_page=200` was answered in full too, and the cursor advances by what a
|
|
#: page returned, so a smaller cap on the host's side would not skip a role.
|
|
PAGE_SIZE = 50
|
|
|
|
#: Only a DNS name with a letter in its last label is a site, so an address
|
|
#: (`127.0.0.1`, `[::1]`) or a single word never names a host the fetch could
|
|
#: be pointed at; `ats._get` still refuses every host but this one, redirects
|
|
#: included.
|
|
_HOST = re.compile(r"[a-z0-9-]+(\.[a-z0-9-]+)*")
|
|
|
|
#: Teamtailor's own namespace in the feed, the `tt:` of `tt:locations`.
|
|
_TT = "{https://teamtailor.com/locations}"
|
|
|
|
#: Teamtailor's `remoteStatus` -> `store._remote`'s words. `none` says nothing
|
|
#: about where the role is worked and `temporary` is remote for a spell only,
|
|
#: so both stay unknown rather than become "onsite" or "remote".
|
|
_REMOTE = {"fully": "remote", "hybrid": "hybrid", "onsite": "onsite"}
|
|
|
|
|
|
def site(slug: str) -> str:
|
|
"""The host a career site is served from: `acme` is acme.teamtailor.com,
|
|
and a slug with a dot is a site on the company's own domain,
|
|
`careers.acme.com`, taken whole (the feed path is the same on both)."""
|
|
slug = slug.strip().lower()
|
|
return slug if "." in slug else f"{slug}.teamtailor.com"
|
|
|
|
|
|
def slug_ok(slug: str) -> bool:
|
|
host = site(slug)
|
|
return bool(slug) and slug == slug.strip() and bool(_HOST.fullmatch(host)) \
|
|
and not host.rsplit(".", 1)[-1].isdigit()
|
|
|
|
|
|
def allowed(slug: str) -> Callable[[str], bool]:
|
|
return only(site(slug))
|
|
|
|
|
|
def careers_url(slug: str) -> str:
|
|
return f"https://{site(slug)}/jobs"
|
|
|
|
|
|
def probe_url(slug: str) -> str:
|
|
return f"https://{site(slug)}/jobs.rss"
|
|
|
|
|
|
def probe_ok(body: bytes) -> bool:
|
|
return b"<item>" in body
|
|
|
|
|
|
def page(get: Get, slug: str, cursor: Any, ask: Ask = Ask()) -> Page:
|
|
offset = int(cursor or 0)
|
|
items = _items(get(f"https://{site(slug)}/jobs.rss?per_page={PAGE_SIZE}&offset={offset}"))
|
|
results = [{"id": item.findtext("guid") or item.findtext("link") or ""} for item in items]
|
|
return items, results, None, offset + len(items) if items else None
|
|
|
|
|
|
def parse(body: bytes, slug: str) -> list[Row]:
|
|
return rows(_items(body), slug)
|
|
|
|
|
|
def _items(body: bytes) -> list[ET.Element]:
|
|
"""`{site}/jobs.rss` -> `<rss><channel><item>...`, the feed every Teamtailor
|
|
career site serves (checked live on a dozen sites, 2026-09-29). A missing
|
|
`channel` is a page that is not a feed, and raises."""
|
|
channel = ET.fromstring(body).find("channel")
|
|
if channel is None:
|
|
raise ValueError("not a Teamtailor feed: no channel")
|
|
return channel.findall("item")
|
|
|
|
|
|
def rows(items: list[ET.Element], slug: str) -> list[Row]:
|
|
"""One page of items. The item has the title, the job URL (on the site's
|
|
own domain), a `guid` uuid, `pubDate`, the HTML `description` in full,
|
|
`remoteStatus` (fully, hybrid, onsite, none or temporary), and, in the
|
|
`tt:` namespace, `locations` (a list: `city` and `country` each, `name` free
|
|
text), `department` and `role`, either of which may be empty. `places` keeps
|
|
the distinct locations, and `location` joins them with "; ". A place is
|
|
remote or an office as far as the role's `remoteStatus` says. No pay is
|
|
stated anywhere in the feed."""
|
|
out = []
|
|
for item in items:
|
|
title = (item.findtext("title") or "").strip()
|
|
url = (item.findtext("link") or "").strip()
|
|
if not title or not is_web_url(url):
|
|
continue
|
|
status = (item.findtext("remoteStatus") or "").strip()
|
|
remote = {"fully": True, "hybrid": False, "onsite": False}.get(status)
|
|
places: list[Place] = []
|
|
for loc in item.findall(f"{_TT}locations/{_TT}location"):
|
|
city = (loc.findtext(f"{_TT}city") or loc.findtext(f"{_TT}name") or "").strip()
|
|
country = (loc.findtext(f"{_TT}country") or "").strip()
|
|
place = city if country == city else ", ".join(p for p in (city, country) if p)
|
|
if place and place not in (p["text"] for p in places):
|
|
places.append({"text": place, "remote": remote})
|
|
out.append({
|
|
"source_id": (item.findtext("guid") or url).strip(),
|
|
"title": title,
|
|
"places": places,
|
|
"location": "; ".join(p["text"] for p in places),
|
|
"url": url,
|
|
"posted": parse_dt(item.findtext("pubDate")),
|
|
"department": ((item.findtext(f"{_TT}department") or "").strip()
|
|
or (item.findtext(f"{_TT}role") or "").strip()),
|
|
"description": html.unescape(strip_html(item.findtext("description") or "")),
|
|
"remote": _REMOTE.get(status),
|
|
"salary_text": "", # Teamtailor's feed states no pay at all
|
|
})
|
|
return out
|