From c2ca1f457e6e826114e8297d5e86eef412b4cddd Mon Sep 17 00:00:00 2001 From: Antoine Date: Tue, 2 Jun 2026 20:06:08 +0200 Subject: [PATCH] fix: align Apec live selectors --- src/job_research/apec/normalize.py | 8 ++---- tests/apec/test_normalize.py | 42 ++++++++++++++---------------- tests/test_apec_cli.py | 8 +++--- 3 files changed, 25 insertions(+), 33 deletions(-) diff --git a/src/job_research/apec/normalize.py b/src/job_research/apec/normalize.py index 4e7239a..2031890 100644 --- a/src/job_research/apec/normalize.py +++ b/src/job_research/apec/normalize.py @@ -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", diff --git a/tests/apec/test_normalize.py b/tests/apec/test_normalize.py index c50206b..e2b5741 100644 --- a/tests/apec/test_normalize.py +++ b/tests/apec/test_normalize.py @@ -3,27 +3,25 @@ from job_research.apec.normalize import normalize_apec_listing def test_normalize_apec_listing_extracts_minimal_shape() -> None: html = """ - - -
-

Data Engineer F/H

-
-
Ref. Apec : 178554452W
-
-
  • CLOUD TEMPLE
  • -
  • 1 CDI
  • -
  • Puteaux - 92
  • -
    -

    Publiée le 20/04/2026 Actualisée le 02/06/2026

    -
    -
    - CLOUD TEMPLE -
    -
    -

    Descriptif du poste

    -

    Build pipelines

    -
    -
    + + +
    +

    Data Engineer F/H

    +
    +
    Ref. Apec : 178554452W
    +
    +
  • CLOUD TEMPLE
  • +
  • 1 CDI
  • +
  • Puteaux - 92
  • +
    +

    Publiée le 20/04/2026 Actualisée le 02/06/2026

    +
    +
    CLOUD TEMPLE
    +
    +

    Descriptif du poste

    +

    Build pipelines

    +
    +

    Profil recherché

    Python / SQL

    @@ -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" diff --git a/tests/test_apec_cli.py b/tests/test_apec_cli.py index ce245fa..e656992 100644 --- a/tests/test_apec_cli.py +++ b/tests/test_apec_cli.py @@ -41,9 +41,7 @@ def _apec_detail_html(

    Publiée le {published_at} Actualisée le {updated_at}

    -
    - {company} -
    +
    {company}

    Descriptif du poste

    {description}

    @@ -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": [],