diff --git a/app/cli.py b/app/cli.py index b88d6f1..399bd5d 100644 --- a/app/cli.py +++ b/app/cli.py @@ -152,8 +152,8 @@ def build_parser() -> argparse.ArgumentParser: search_add.add_argument("--where", default="", help="adzuna place, e.g. Berlin") search_add.add_argument("--region", default="", help="platsbanken län id: CaRE_1nn_cSU is Skåne, empty all of " - "Sweden" + _ids("jobnet", "REGIONS", "; jobnet region") - + _ids("jobbank", "REGIONS", "; jobbank amt")) + "Sweden" + _ids("jobnet", "REGIONS", "; jobnet region: ") + + _ids("jobbank", "REGIONS", "; jobbank amt: ")) search_add.add_argument("--remote", default="", help="freehire work mode" + _ids("freehire", "MODES", ": ") + _ids("jobbank", "REMOTE", "; jobbank remote work: ") diff --git a/plugins/readers/freehire.py b/plugins/readers/freehire.py index 234da67..7eaf616 100644 --- a/plugins/readers/freehire.py +++ b/plugins/readers/freehire.py @@ -27,6 +27,7 @@ table of the host's words in `app/prep/hosts/freehire.py`. from __future__ import annotations +import html import json import re from collections.abc import Callable @@ -166,7 +167,7 @@ def _pay(enrichment: dict[str, Any]) -> dict[str, Any]: def rows(decoded: Any, slug: str) -> list[Row]: out: list[Row] = [] for hit in decoded.get("data") or []: - title = " ".join(str(hit.get("title") or "").split()) + title = " ".join(html.unescape(str(hit.get("title") or "")).split()) source_id = str(hit.get("public_slug") or "").strip() url = _url(str(hit.get("url") or "")) if not title or not source_id or not is_web_url(url): @@ -177,7 +178,7 @@ def rows(decoded: Any, slug: str) -> list[Row]: out.append({ "source_id": source_id, "title": title, - "company": str(hit.get("company") or "").strip(), + "company": html.unescape(str(hit.get("company") or "")).strip(), "url": url, "places": places, "location": places[0]["text"] if places else "", diff --git a/tests/test_readers_freehire.py b/tests/test_readers_freehire.py index 8bc4702..03780cd 100644 --- a/tests/test_readers_freehire.py +++ b/tests/test_readers_freehire.py @@ -129,6 +129,13 @@ def test_it_refuses_a_hit_without_a_title_an_id_or_a_web_link() -> None: assert found[0]["url"] == "https://x.example/d" and found[0]["places"] == [] +def test_a_title_and_a_company_have_their_entities_decoded() -> None: + hit = {"public_slug": "a", "title": "IoT Certification & License Manager", + "company": "Ben & Jerry's", "url": "https://x.example/a"} + row = freehire.rows({"data": [hit]}, "")[0] + assert (row["title"], row["company"]) == ("IoT Certification & License Manager", "Ben & Jerry's") + + def test_it_asks_for_countries_work_mode_and_the_text_in_html() -> None: asked: list[str] = [] freehire.page(_stock(250, 250, asked), "", None,