Discover Teamtailor boards as readable, own-domain sites by their host

Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
This commit is contained in:
WolfandClaude Sonnet 5.5 committed 2026-09-29 16:14:41 +02:00
1 parent 50edf0eeeb
commit b2ab2a270d
2 files changed
+74 -8

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 carries one, so the company is kept as one the app cannot read yet rather
than dropped. 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 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 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 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`. #: The hosts the `ats` plugin parses; a match on one of these is a `board`.
READABLE = ("greenhouse", "lever", "ashby", "workable", "smartrecruiters", 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 -> 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 #: 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_-]+)"), ("smartrecruiters", r"(?:jobs|careers|api)\.smartrecruiters\.com/(?:v1/companies/)?([A-Za-z0-9_-]+)"),
("recruitee", r"https?://([a-z0-9-]+)\.recruitee\.com"), ("recruitee", r"https?://([a-z0-9-]+)\.recruitee\.com"),
("personio", r"https?://([a-z0-9-]+)\.jobs\.personio\.(?:de|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 # Not readable. The slug, where the URL has one, is kept for the day
# a parser exists. # a parser exists.
("workday", r"https?://([a-z0-9-]+)\.wd\d+\.myworkdayjobs\.com"), ("workday", r"https?://([a-z0-9-]+)\.wd\d+\.myworkdayjobs\.com"),
("successfactors", r"(?:career|jobs|performancemanager)\d*\.successfactors\.(?:eu|com)|\.sapsf\.(?:eu|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"), ("icims", r"https?://([a-z0-9-]+)\.icims\.com"),
("taleo", r"\.taleo\.net"), ("taleo", r"\.taleo\.net"),
("jobvite", r"jobs\.jobvite\.com/([a-z0-9-]+)"), ("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"), ("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 #: 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. #: links so the site's word for it wins over a guess.
CAREERS_PATHS = ("/careers", "/careers/", "/jobs", "/en/careers", "/company/careers", 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' #: Words a pattern's slug group can catch that name no board: the hosts'
#: own path segments, the analytics subdomain Recruitee sites embed, and #: 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", _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) 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", "smartrecruiters": "https://api.smartrecruiters.com/v1/companies/{slug}/postings?limit=1",
"recruitee": "https://{slug}.recruitee.com/api/offers/", "recruitee": "https://{slug}.recruitee.com/api/offers/",
"personio": "https://{slug}.jobs.personio.de/xml", "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 return b'"offers":[' in body and b'"offers":[]' not in body
if host == "personio": if host == "personio":
return b"<position>" in body return b"<position>" in body
if host == "teamtailor":
return b"<item>" in body
return True 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}/") home_url, home = fetch(client, f"https://{site}/")
unreadable: Discovery | None = None unreadable: Discovery | None = None
careers_page = "" 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: def first_readable(found: list[Found], page: str) -> Discovery | None:
"""The first readable board on a page. Otherwise the first host named """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.""" may name teamtailor by its CDN before it links acme.teamtailor.com."""
nonlocal unreadable nonlocal unreadable
for host, slug, url in found: 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: if host in READABLE and slug:
return Discovery(board=f"{host}:{slug}", ats=host, ats_slug=slug, return Discovery(board=f"{host}:{slug}", ats=host, ats_slug=slug,
careers_url=page, evidence=url) 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): if hit := first_readable(boards_in(text), final):
return hit return hit
queue[:0] = [link for link in careers_links(text, final)[:2] if link not in seen] 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 # 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. # probe could only add another tenant's board of the same name.
if unreadable is not None: if unreadable is not None:
+43 -3
View File
@@ -160,7 +160,7 @@ def test_a_readable_board_on_a_later_page_still_beats_an_unreadable_host() -> No
assert site.probed == [] assert site.probed == []
def test_an_unreadable_hosts_slug_is_kept_when_a_later_link_names_it() -> None: def test_a_teamtailor_link_is_a_board_even_after_the_cdn_named_it_first() -> None:
"""The CDN names teamtailor before any link does; the slug comes from the """The CDN names teamtailor before any link does; the slug comes from the
first link that carries one, the acme of acme.teamtailor.com.""" first link that carries one, the acme of acme.teamtailor.com."""
site = Site({ site = Site({
@@ -168,9 +168,49 @@ def test_an_unreadable_hosts_slug_is_kept_when_a_later_link_names_it() -> None:
"https://acme.com/careers": '<a href="https://acme-jobs.teamtailor.com/jobs">Jobs</a>', "https://acme.com/careers": '<a href="https://acme-jobs.teamtailor.com/jobs">Jobs</a>',
}) })
found = run(site) found = run(site)
assert (found.ats, found.ats_slug, found.board) == ("teamtailor", "acme-jobs", "") assert (found.ats, found.ats_slug, found.board) == ("teamtailor", "acme-jobs",
"teamtailor:acme-jobs")
assert found.readable
assert found.evidence == "https://acme-jobs.teamtailor.com" assert found.evidence == "https://acme-jobs.teamtailor.com"
assert found.careers_url == "https://acme.com/" assert found.careers_url == "https://acme.com/careers"
def test_a_teamtailor_site_on_its_own_domain_is_read_off_its_host() -> None:
"""Only the CDN is named, so the site's host is the slug, once that host
serves the feed."""
site = Site({
"https://acme.com/": '<a href="https://careers.acme.com/">Careers</a>',
"https://careers.acme.com/": '<script src="https://cdn.teamtailor.com/x.js"></script>',
"https://careers.acme.com/jobs.rss":
'<rss xmlns:tt="https://teamtailor.com/locations"><channel/></rss>',
})
found = run(site)
assert found == Discovery(board="teamtailor:careers.acme.com", ats="teamtailor",
ats_slug="careers.acme.com",
careers_url="https://careers.acme.com/",
evidence="https://careers.acme.com/jobs.rss")
assert site.probed == []
def test_a_page_that_only_loads_the_cdn_is_not_a_board_without_the_feed() -> None:
site = Site({"https://acme.com/": '<script src="https://cdn.teamtailor.com/x.js"></script>'})
found = run(site)
assert (found.ats, found.ats_slug, found.board) == ("teamtailor", "", "")
assert not found.readable
assert "https://acme.com/jobs.rss" in site.fetched
def test_the_admin_app_and_cdn_hosts_are_no_teamtailor_slug() -> None:
page = '<a href="https://app.teamtailor.com/x">a</a><img src="https://cdn.teamtailor.com/y">'
assert [(h, s) for h, s, _ in boards_in(page)] == [("teamtailor", "")]
def test_a_teamtailor_board_is_found_by_its_slug_probe() -> None:
site = Site({"https://acme.com/": "<p>a script draws the jobs</p>"},
boards={("teamtailor", "acme")})
found = run(site)
assert found.board == "teamtailor:acme"
assert found.evidence == "https://acme.teamtailor.com/jobs.rss"
def test_slug_probes_find_a_board_the_pages_never_link() -> None: def test_slug_probes_find_a_board_the_pages_never_link() -> None: