mere-teal
mere-teal2y ago

htmlToText not defined

I want to convert whole body of html to text. I'm trying this https://crawlee.dev/api/utils/function/htmlToText but its not finding htmlToText function. It says it's not defined. And yes I am doing import as described
import cheerio from 'cheerio'
import cheerio from 'cheerio'
I am also open to other options like turndown library. I don't want to convert just one element to text but the whole content of the page
3 Replies
Saurav Jain
Saurav Jain2y ago
working for me after adding:
import {htmlToText} from "crawlee";
import {htmlToText} from "crawlee";
Lukas Celnar
Lukas Celnar2y ago
Also seems to work for me import { htmlToText } from 'crawlee'; log.info(htmlToText($)); Make sure you are importing it from crawlee and please doublecheck that you are using the latest crawlee version.
Saurav Jain
Saurav Jain2y ago
yeah, we don't mention importing functions in single examples.

Did you find this page helpful?