fix: align Apec live selectors
This commit is contained in:
parent
1c267520f0
commit
c2ca1f457e
@ -105,7 +105,7 @@ def normalize_apec_listing(
|
||||
title = soup.select_one(".container-details-offer h1") or soup.find("h1")
|
||||
details_offer_list = soup.select_one(".details-offer-list")
|
||||
|
||||
company = soup.select_one(".card-ents .ents-name")
|
||||
company = soup.select_one(".card-ents-quote, .card-ents .ents-name")
|
||||
if company is None and details_offer_list is not None:
|
||||
company = details_offer_list.select_one("li:nth-of-type(1)")
|
||||
|
||||
@ -115,11 +115,7 @@ def normalize_apec_listing(
|
||||
location = details_offer_list.select_one("li:nth-of-type(3)")
|
||||
contract_type = _extract_contract_type(details_offer_list)
|
||||
|
||||
description_sections = [
|
||||
_detail_block_text(soup, "Descriptif du poste"),
|
||||
_detail_block_text(soup, "Profil recherché"),
|
||||
]
|
||||
description_text = "\n\n".join(section for section in description_sections if section)
|
||||
description_text = _detail_block_text(soup, "Descriptif du poste")
|
||||
|
||||
return ApecListing(
|
||||
source="apec",
|
||||
|
||||
@ -3,27 +3,25 @@ from job_research.apec.normalize import normalize_apec_listing
|
||||
|
||||
def test_normalize_apec_listing_extracts_minimal_shape() -> None:
|
||||
html = """
|
||||
<html>
|
||||
<body>
|
||||
<main class="container-details-offer">
|
||||
<h1>Data Engineer F/H</h1>
|
||||
<div class="card-offer">
|
||||
<div class="ref-offre">Ref. Apec : 178554452W</div>
|
||||
<div class="details-offer-list">
|
||||
<li>CLOUD TEMPLE</li>
|
||||
<li>1 <span> CDI </span></li>
|
||||
<li>Puteaux - 92</li>
|
||||
</div>
|
||||
<p>Publiée le 20/04/2026 Actualisée le 02/06/2026</p>
|
||||
</div>
|
||||
<div class="card-ents">
|
||||
<span class="ents-name">CLOUD TEMPLE</span>
|
||||
</div>
|
||||
<div class="details-post">
|
||||
<h4>Descriptif du poste</h4>
|
||||
<p>Build pipelines</p>
|
||||
</div>
|
||||
<div class="details-post">
|
||||
<html>
|
||||
<body>
|
||||
<main class="container-details-offer">
|
||||
<h1>Data Engineer F/H</h1>
|
||||
<div class="card-offer">
|
||||
<div class="ref-offre">Ref. Apec : 178554452W</div>
|
||||
<div class="details-offer-list">
|
||||
<li>CLOUD TEMPLE</li>
|
||||
<li>1 <span> CDI </span></li>
|
||||
<li>Puteaux - 92</li>
|
||||
</div>
|
||||
<p>Publiée le 20/04/2026 Actualisée le 02/06/2026</p>
|
||||
</div>
|
||||
<div class="card-ents-quote">CLOUD TEMPLE</div>
|
||||
<div class="details-post">
|
||||
<h4>Descriptif du poste</h4>
|
||||
<p>Build pipelines</p>
|
||||
</div>
|
||||
<div class="details-post">
|
||||
<h4>Profil recherché</h4>
|
||||
<p>Python / SQL</p>
|
||||
</div>
|
||||
@ -46,6 +44,6 @@ def test_normalize_apec_listing_extracts_minimal_shape() -> None:
|
||||
assert listing.company == "CLOUD TEMPLE"
|
||||
assert listing.location == "Puteaux - 92"
|
||||
assert listing.contract_type == "CDI"
|
||||
assert listing.description_text == "Build pipelines\n\nPython / SQL"
|
||||
assert listing.description_text == "Build pipelines"
|
||||
assert listing.published_at == "2026-04-20"
|
||||
assert listing.fetched_at == "2026-06-01T10:00:00Z"
|
||||
|
||||
@ -41,9 +41,7 @@ def _apec_detail_html(
|
||||
<p>Publiée le {published_at} Actualisée le {updated_at}</p>
|
||||
</div>
|
||||
</article>
|
||||
<div class="card-ents">
|
||||
<span class="ents-name">{company}</span>
|
||||
</div>
|
||||
<div class="card-ents-quote">{company}</div>
|
||||
<div class="details-post">
|
||||
<h4>Descriptif du poste</h4>
|
||||
<p>{description}</p>
|
||||
@ -131,7 +129,7 @@ def test_fetch_apec_reads_profile_and_writes_run_artifacts(tmp_path, monkeypatch
|
||||
"company": "Example Corp",
|
||||
"location": "Paris - 75",
|
||||
"contract_type": "CDI",
|
||||
"description_text": "Build pipelines\n\nPython / SQL",
|
||||
"description_text": "Build pipelines",
|
||||
"published_at": "2026-04-20",
|
||||
"fetched_at": "2026-06-01T10:00:00Z",
|
||||
"warnings": [],
|
||||
@ -219,7 +217,7 @@ def test_fetch_apec_records_partial_failures_without_losing_successful_listings(
|
||||
"company": "Example Corp",
|
||||
"location": "Paris - 75",
|
||||
"contract_type": "CDI",
|
||||
"description_text": "Build pipelines\n\nPython / SQL",
|
||||
"description_text": "Build pipelines",
|
||||
"published_at": "2026-04-20",
|
||||
"fetched_at": "2026-06-01T10:00:00Z",
|
||||
"warnings": [],
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user