@socialgouv/fiches-travail-data-types 4.428.0 → 4.430.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
|
@@ -139,7 +139,8 @@ function parseDom(dom, id, url) {
|
|
|
139
139
|
let intro = $(article, ".main-article__chapo") || "";
|
|
140
140
|
intro =
|
|
141
141
|
intro && intro.innerHTML.replace(/\n/g, "").replace(/\s+/g, " ").trim();
|
|
142
|
-
const description = $(dom.window.document, "meta[name=description]")
|
|
142
|
+
const description = $(dom.window.document, "meta[name=description]")?.getAttribute("content") ??
|
|
143
|
+
"";
|
|
143
144
|
const sections = [];
|
|
144
145
|
const sectionTag = getSectionTag(article);
|
|
145
146
|
// First pass is only to get a potential untitled section at the top of the article
|
|
@@ -53,7 +53,7 @@ const htmlPostParser = (html) => {
|
|
|
53
53
|
currentIndex++;
|
|
54
54
|
return `<img src="https://travail-emploi.gouv.fr/${src}" style="width:100%;height:auto;"/>`;
|
|
55
55
|
}
|
|
56
|
-
return
|
|
56
|
+
return $.html()?.toString() ?? "";
|
|
57
57
|
});
|
|
58
58
|
return $.html();
|
|
59
59
|
};
|
|
@@ -32,7 +32,8 @@ async function scrapUrl(id, url) {
|
|
|
32
32
|
}
|
|
33
33
|
}
|
|
34
34
|
const dom = new jsdom_1.JSDOM(response.body, { url });
|
|
35
|
-
|
|
35
|
+
const res = (0, parseDom_1.parseDom)(dom, id, url);
|
|
36
|
+
return res;
|
|
36
37
|
}
|
|
37
38
|
catch (error) {
|
|
38
39
|
let err;
|