Merge branch 'wp3-teamtailor'

This commit is contained in:
Wolf committed 2026-09-29 16:15:22 +02:00
commit d887a91af0
4 files changed
+461 -41

No files matched your search

+31 -5
View File
@@ -10,6 +10,10 @@ read; any other host is recorded as `ats`, with its slug where the URL
carries one, so the company is kept as one the app cannot read yet rather
than dropped.
A Teamtailor site on the company's own domain names no slug: the page only
loads Teamtailor's CDN. The board there is the site's own host, and it is
taken only once that host answers `/jobs.rss` with a Teamtailor feed.
Only when no page names a host at all are the hosts with a cheap per-slug
endpoint (`_PROBES`) probed with the company's own slug, because a site that
draws its jobs from an iframe or a script leaves no link to find. A page that
@@ -50,7 +54,7 @@ MAX_PAGES = 6
#: The hosts the `ats` plugin parses; a match on one of these is a `board`.
READABLE = ("greenhouse", "lever", "ashby", "workable", "smartrecruiters",
"recruitee", "personio")
"recruitee", "personio", "teamtailor")
#: host -> pattern over a URL. Group 1, where there is one, is the slug the
#: host names the company by; a host with no group is recognised but its
@@ -70,12 +74,14 @@ HOSTS: tuple[tuple[str, re.Pattern[str]], ...] = tuple(
("smartrecruiters", r"(?:jobs|careers|api)\.smartrecruiters\.com/(?:v1/companies/)?([A-Za-z0-9_-]+)"),
("recruitee", r"https?://([a-z0-9-]+)\.recruitee\.com"),
("personio", r"https?://([a-z0-9-]+)\.jobs\.personio\.(?:de|com)"),
("teamtailor", r"https?://([a-z0-9-]+)\.teamtailor\.com"),
# No slug: a career site on the company's own domain, which only loads
# Teamtailor's CDN. `_discover` reads its board off the page's host.
("teamtailor", r"cdn\.teamtailor\.com|teamtailor-cdn|teamtailor\.com/assets"),
# Not readable. The slug, where the URL has one, is kept for the day
# a parser exists.
("workday", r"https?://([a-z0-9-]+)\.wd\d+\.myworkdayjobs\.com"),
("successfactors", r"(?:career|jobs|performancemanager)\d*\.successfactors\.(?:eu|com)|\.sapsf\.(?:eu|com)"),
("teamtailor", r"https?://([a-z0-9-]+)\.teamtailor\.com"),
("teamtailor", r"cdn\.teamtailor\.com|teamtailor-cdn|teamtailor\.com/assets"),
("icims", r"https?://([a-z0-9-]+)\.icims\.com"),
("taleo", r"\.taleo\.net"),
("jobvite", r"jobs\.jobvite\.com/([a-z0-9-]+)"),
@@ -97,6 +103,10 @@ HOSTS: tuple[tuple[str, re.Pattern[str]], ...] = tuple(
("hibob", r"https?://([a-z0-9-]+)\.hibob\.com"),
))
#: What a Teamtailor feed carries and a page that only looks like one does not:
#: the namespace of `tt:locations`, declared on `<rss>` even when no role is open.
TEAMTAILOR_FEED = "https://teamtailor.com/locations"
#: Paths a careers page usually lives at, tried after the home page's own
#: links so the site's word for it wins over a guess.
CAREERS_PATHS = ("/careers", "/careers/", "/jobs", "/en/careers", "/company/careers",
@@ -117,9 +127,10 @@ _TAGS = re.compile(r"<[^>]+>")
#: Words a pattern's slug group can catch that name no board: the hosts'
#: own path segments, the analytics subdomain Recruitee sites embed, and
#: the CDN Teamtailor sites load from (cdn.teamtailor.com).
#: the CDN and the admin app Teamtailor sites load from (cdn.teamtailor.com,
#: app.teamtailor.com).
_NOT_SLUGS = frozenset({"embed", "boards", "v1", "api", "www", "jobs", "careers", "apply",
"careers-analytics", "cdn"})
"careers-analytics", "cdn", "app"})
Found = tuple[str, str, str] # (host, slug, the URL that named it)
@@ -236,6 +247,7 @@ _PROBES = {
"smartrecruiters": "https://api.smartrecruiters.com/v1/companies/{slug}/postings?limit=1",
"recruitee": "https://{slug}.recruitee.com/api/offers/",
"personio": "https://{slug}.jobs.personio.de/xml",
"teamtailor": "https://{slug}.teamtailor.com/jobs.rss",
}
@@ -260,6 +272,8 @@ def probe(client: httpx.Client, host: str, slug: str) -> bool:
return b'"offers":[' in body and b'"offers":[]' not in body
if host == "personio":
return b"<position>" in body
if host == "teamtailor":
return b"<item>" in body
return True
@@ -305,6 +319,7 @@ def _discover(name: str, site: str, client: httpx.Client, fetch: Fetch,
home_url, home = fetch(client, f"https://{site}/")
unreadable: Discovery | None = None
careers_page = ""
own_sites: list[tuple[str, str]] = [] # (host, page) that loaded Teamtailor's CDN
def first_readable(found: list[Found], page: str) -> Discovery | None:
"""The first readable board on a page. Otherwise the first host named
@@ -312,6 +327,9 @@ def _discover(name: str, site: str, client: httpx.Client, fetch: Fetch,
may name teamtailor by its CDN before it links acme.teamtailor.com."""
nonlocal unreadable
for host, slug, url in found:
site_host = httpx.URL(page).host if page else ""
if host == "teamtailor" and not slug and site_host and (site_host, page) not in own_sites:
own_sites.append((site_host, page))
if host in READABLE and slug:
return Discovery(board=f"{host}:{slug}", ats=host, ats_slug=slug,
careers_url=page, evidence=url)
@@ -347,6 +365,14 @@ def _discover(name: str, site: str, client: httpx.Client, fetch: Fetch,
if hit := first_readable(boards_in(text), final):
return hit
queue[:0] = [link for link in careers_links(text, final)[:2] if link not in seen]
# A page loaded Teamtailor's CDN and linked no *.teamtailor.com: the site
# itself is the board, if it serves the feed.
for site_host, page in own_sites:
feed = f"https://{site_host}/jobs.rss"
_final, text = fetch(client, feed)
if TEAMTAILOR_FEED in text:
return Discovery(board=f"teamtailor:{site_host}", ats="teamtailor",
ats_slug=site_host, careers_url=page, evidence=feed)
# A page named a host the app cannot read: that is the answer, and a
# probe could only add another tenant's board of the same name.
if unreadable is not None: