Max body/text length

Hello,

Before i start messing around with function nodes, Is there a way to have a max text length as an expression?

and, (I wasnt sure i should’ve created a new thread for this)

Is there a way to do this with any kind of text?

Since i just need the Text, Not the HTML

Hey,
Sorry but I am not sure what exactly you want to do. Can you please provide a bit more detail?
Thanks

I got a string of html with text in it, I just need the text

For the max length i figured out i can do this
{{$node["IF"].json["Body"].slice(0, 75)}}

You’ll have to enter a CSS selector in the CSS Selector field. This can be a class (append with a ‘.’), an id (append with ‘#’) or an HTML tag.
The Key field sets the key for the value that will be returned. For example, if you’re extracting links, your key can be Link and the CSS selector can be a (for the anchor tag).

Below is an example workflow that returns text that is wrapped by the HTML tag containing the class link-primary.

{
  "nodes": [
    {
      "parameters": {
        "url": "https://n8n.io",
        "responseFormat": "string",
        "options": {}
      },
      "name": "HTTP Request",
      "type": "n8n-nodes-base.httpRequest",
      "typeVersion": 1,
      "position": [
        650,
        220
      ]
    },
    {
      "parameters": {
        "extractionValues": {
          "values": [
            {
              "key": "Link",
              "cssSelector": ".link-primary"
            }
          ]
        },
        "options": {}
      },
      "name": "HTML Extract",
      "type": "n8n-nodes-base.htmlExtract",
      "typeVersion": 1,
      "position": [
        860,
        220
      ]
    }
  ],
  "connections": {
    "HTTP Request": {
      "main": [
        [
          {
            "node": "HTML Extract",
            "type": "main",
            "index": 0
          }
        ]
      ]
    }
  }
}

I hope this helps :slightly_smiling_face:

I got it to work :wink: Had to figure out i needed put something else in then “data”

1 Like

That’s great! Have fun :slightly_smiling_face:

1 Like