Skip to content

Crawlee—A web scraping and browser automation library for Node.js to build reliable crawlers. In JavaScript and TypeScript. Extract data for AI, LLMs, RAG, or GPTs. Download HTML, PDF, JPG, PNG, and other files from websites. Works with Puppeteer, Playwright, Cheerio, JSDOM, and raw HTTP. Both headful and headless mode. With proxy rotation.

Fixed references to Apify.utils.htmlToText() in utils_social.js as tests

Jan Curn2c2697afdf9c
diff --git a/src/utils_social.js b/src/utils_social.js
index 8245c43f6..262af4ee7 100644
--- a/src/utils_social.js
+++ b/src/utils_social.js
@@ -2,7 +2,7 @@
import _ from 'underscore';
import cheerio from 'cheerio';
import log from 'apify-shared/log';
-import { htmlToText } from './utils';
+import { publicUtils } from './utils';
// TODO: Finish docs and examples !!!
@@ -490,7 +490,7 @@ const parseHandlesFromHtml = (html, data = null) => {
const $ = cheerio.load(html, { decodeEntities: true });
if (data) data.$ = $;
- const text = htmlToText($);
+ const text = publicUtils.htmlToText($);
if (data) data.text = text;
// Find all <a> links with href tag
diff --git a/test/utils.js b/test/utils.js
index 1696dd36f..6fe0cd72b 100644
--- a/test/utils.js
+++ b/test/utils.js
@@ -658,7 +658,7 @@ describe('utils.openRemoteStorage()', async () => {
});
const checkHtmlToText = (html, expectedText, hasBody = false) => {
- const text1 = utils.htmlToText(html);
+ const text1 = Apify.utils.htmlToText(html);
expect(text1).to.eql(expectedText);
// Test embedding into <body> gives the same result
@@ -678,7 +678,7 @@ const checkHtmlToText = (html, expectedText, hasBody = false) => {
${html}
</body>
</html>`;
- const text2 = utils.htmlToText(html2);
+ const text2 = Apify.utils.htmlToText(html2);
expect(text2).to.eql(expectedText);
}
};