Conversation
Contributor
There was a problem hiding this comment.
Pull request overview
Implements homepage URL filtering for Bundesagentur (BA) job listings so users don’t see generic/non-actionable “apply” links (e.g., BA homepage or company root/careers landing pages), aligning with Issue #40’s link hygiene goal.
Changes:
- Added
_is_homepage_url()heuristic to classify and filter generic homepage-like partner URLs. - Updated BA listing parsing to drop partner apply links deemed “homepage URLs” and added batch logging for filtered links.
- Expanded Bundesagentur test suite with unit tests for the heuristic and integration-style tests for filtering behavior.
Reviewed changes
Copilot reviewed 2 out of 2 changed files in this pull request and generated 4 comments.
| File | Description |
|---|---|
immermatch/search_api/bundesagentur.py |
Adds homepage URL detection + filters partner apply links during BA listing parsing; logs filtered counts per enrich batch. |
tests/test_bundesagentur.py |
Updates existing external URL expectations and adds new tests for homepage URL detection + filtering in _parse_listing. |
You can also share your feedback on Copilot code review. Take the survey.
Comment on lines
+75
to
+79
| host = parsed.hostname or "" | ||
| path = parsed.path.rstrip("/") | ||
|
|
||
| # BA homepage — host is arbeitsagentur.de but NOT a jobdetail link | ||
| if host.endswith("arbeitsagentur.de"): |
Comment on lines
+82
to
+83
| # Root-path URL (e.g. https://company.de/) | ||
| if not path: |
Comment on lines
238
to
+248
| ext_url = str(detail.get("allianzpartnerUrl", "")).strip() | ||
| if ext_url: | ||
| if ext_url.startswith("//"): | ||
| ext_url = f"https:{ext_url}" | ||
| elif not re.match(r"^[a-zA-Z][a-zA-Z0-9+.-]*://", ext_url): | ||
| ext_url = f"https://{ext_url}" | ||
| ext_name = detail.get("allianzpartnerName", "Company Website") | ||
| apply_options.append(ApplyOption(source=ext_name, url=ext_url)) | ||
| if _is_homepage_url(ext_url): | ||
| logger.debug("Filtered homepage partner URL for %s: %s", refnr, ext_url) | ||
| else: | ||
| ext_name = detail.get("allianzpartnerName", "Company Website") | ||
| apply_options.append(ApplyOption(source=ext_name, url=ext_url)) |
Comment on lines
+615
to
+626
| def test_root_url(self) -> None: | ||
| assert _is_homepage_url("https://company.de/") is True | ||
|
|
||
| def test_generic_karriere_page(self) -> None: | ||
| assert _is_homepage_url("https://company.de/karriere") is True | ||
|
|
||
| def test_generic_careers_page(self) -> None: | ||
| assert _is_homepage_url("https://company.de/careers") is True | ||
|
|
||
| def test_deep_job_url(self) -> None: | ||
| assert _is_homepage_url("https://company.de/jobs/12345") is False | ||
|
|
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Closes #40