lassonde : repli HTML pour la description (le site maison n'expose aucun JSON-LD JobPosting — corps de page après le h1, cache purgé et re-synchronisé : 31/31 offres décrites, 0 quarantaine)
1 changed file +12 −1
modified
jobka/connectors/lassonde.py
+12 −1
@@ -43,9 +43,20 @@ class LassondeConnector(BaseConnector): | ||
| 43 | 43 | LIST_URL = "https://www.lassonde.com/fr/emplois/" |
| 44 | 44 | |
| 45 | 45 | def _fetch_detail(self, url: str) -> dict: |
| 46 | + """Le site n'expose pas de JSON-LD JobPosting (seulement un @graph | |
| 47 | + WebPage) : la description vient du corps de la page (après le h1).""" | |
| 46 | 48 | html = self.get(url).text |
| 47 | 49 | node = _jsonld.extract_jobposting(html) |
| 48 | − return _jsonld.jobposting_fields(node) if node else {} | |
| 50 | + if node: | |
| 51 | + return _jsonld.jobposting_fields(node) | |
| 52 | + m = re.search(r"</h1>(.*?)<(?:footer|form|nav)\b", html, re.S | re.I) | |
| 53 | + if not m: | |
| 54 | + return {} | |
| 55 | + from ..schema import clean_html | |
| 56 | + text = clean_html(m.group(1)) | |
| 57 | + if len(text) < 100: | |
| 58 | + return {} | |
| 59 | + return {"description_html": m.group(1)[:60000]} | |
| 49 | 60 | |
| 50 | 61 | def fetch(self) -> list[JobPosting]: |
| 51 | 62 | page = self.get(self.LIST_URL).text |
| 52 | 63 | |