How can I retrieve "url" after "Http request"

Hello, I’m a beginner who just started using n8n.

I’m receiving news feeds via RSS, but some articles have very limited content, so I send an HTTP request to the URL to retrieve the full content.

The problem is that the output of the HTTP request contains only the content, and the URL is missing. Because of that, it’s hard to know which URL the content originally came from.

Is there any way to keep the URL?

(Select the nodes on your canvas and use the keyboard shortcuts CMD+C/CTRL+C and CMD+V/CTRL+V to copy and paste the workflow.)

{
  "nodes": [
    {
      "parameters": {
        "url": "https://newatlas.com/robotics/index.rss",
        "options": {}
      },
      "type": "n8n-nodes-base.rssFeedRead",
      "typeVersion": 1.2,
      "position": [
        -288,
        880
      ],
      "id": "7569cead-cce3-4010-9773-9fb334487a2a",
      "name": "newatlas"
    },
    {
      "parameters": {
        "assignments": {
          "assignments": [
            {
              "id": "1d8f27ff-7d5f-49b0-9e24-1c170d1e813f",
              "name": "isoDate",
              "value": "={{ $json.isoDate }}",
              "type": "string"
            },
            {
              "id": "35dbacd9-4541-4420-82ec-5229e00130c4",
              "name": "title",
              "value": "={{ $json.title }}",
              "type": "string"
            },
            {
              "id": "1999d4ea-51d8-4560-b7c8-22c9adb51861",
              "name": "content:encodedSnippet",
              "value": "={{ $json.contentSnippet }}",
              "type": "string"
            },
            {
              "id": "4cd02e63-2772-40b2-bf19-88c2b6eb1309",
              "name": "link",
              "value": "={{ $json.link }}",
              "type": "string"
            }
          ]
        },
        "options": {}
      },
      "type": "n8n-nodes-base.set",
      "typeVersion": 3.4,
      "position": [
        -80,
        880
      ],
      "id": "08ac0e53-a526-4260-8698-e128350b5671",
      "name": "Edit Fields2"
    },
    {
      "parameters": {
        "url": "={{ $json.link }}",
        "options": {}
      },
      "type": "n8n-nodes-base.httpRequest",
      "typeVersion": 4.3,
      "position": [
        304,
        992
      ],
      "id": "630853ff-85fa-4024-ad07-066ea35f1857",
      "name": "HTTP Request1"
    },
    {
      "parameters": {
        "operation": "extractHtmlContent",
        "extractionValues": {
          "values": [
            {
              "key": "full_content",
              "cssSelector": ".ArticlePage-articleBody"
            }
          ]
        },
        "options": {}
      },
      "type": "n8n-nodes-base.html",
      "typeVersion": 1.2,
      "position": [
        480,
        992
      ],
      "id": "29a31fd8-1ccc-45bb-a0e3-06811255c20d",
      "name": "HTML1"
    },
    {
      "parameters": {
        "options": {}
      },
      "type": "n8n-nodes-base.splitInBatches",
      "typeVersion": 3,
      "position": [
        80,
        992
      ],
      "id": "4cb91e70-fc3b-4c3b-a439-6771e2b96aec",
      "name": "Loop Over Items1"
    },
    {
      "parameters": {
        "assignments": {
          "assignments": [
            {
              "id": "056774d8-f788-40b2-8b3d-8a3027fdf425",
              "name": "",
              "value": "={{ $('Loop Over Items1').item.json }}",
              "type": "object"
            },
            {
              "id": "2a808bdd-cef3-4816-861a-dfd30f925001",
              "name": "",
              "value": "={{ $json.file }}",
              "type": "array"
            }
          ]
        },
        "options": {}
      },
      "type": "n8n-nodes-base.set",
      "typeVersion": 3.4,
      "position": [
        864,
        992
      ],
      "id": "9913818e-d872-452a-9bdd-51fb5e5d282a",
      "name": "Edit Fields14"
    },
    {
      "parameters": {
        "aggregate": "aggregateAllItemData",
        "destinationFieldName": "file",
        "options": {}
      },
      "type": "n8n-nodes-base.aggregate",
      "typeVersion": 1,
      "position": [
        656,
        992
      ],
      "id": "32aa6bf8-4c99-4435-a5f1-4c1730365775",
      "name": "Aggregate2"
    },
    {
      "parameters": {},
      "type": "n8n-nodes-base.manualTrigger",
      "typeVersion": 1,
      "position": [
        -480,
        880
      ],
      "id": "3847b986-6569-4ee3-afcb-472d923a8872",
      "name": "When clicking ‘Execute workflow’"
    }
  ],
  "connections": {
    "newatlas": {
      "main": [
        [
          {
            "node": "Edit Fields2",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Edit Fields2": {
      "main": [
        [
          {
            "node": "Loop Over Items1",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "HTTP Request1": {
      "main": [
        [
          {
            "node": "HTML1",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "HTML1": {
      "main": [
        [
          {
            "node": "Aggregate2",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Loop Over Items1": {
      "main": [
        [],
        [
          {
            "node": "HTTP Request1",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Edit Fields14": {
      "main": [
        [
          {
            "node": "Loop Over Items1",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Aggregate2": {
      "main": [
        [
          {
            "node": "Edit Fields14",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "When clicking ‘Execute workflow’": {
      "main": [
        [
          {
            "node": "newatlas",
            "type": "main",
            "index": 0
          }
        ]
      ]
    }
  },
  "pinData": {},
  "meta": {
    "templateCredsSetupCompleted": true,
    "instanceId": "b333e74cf9fd5121820905822cd3fcb71eaf267cbc19851dafa8b904b15abcf2"
  }
}

Hey @hms !

You’re very close already — n8n will keep the URL if it’s present on the item before the HTTP Request, and you reference it via expressions.

In your workflow, Edit Fields2 already copies the RSS link into link, and the HTTP Request uses {{$json.link}} as its URL. That means after HTTP Request1 and HTML1, you can still access the original URL with:

{{ $(‘Loop Over Items1’).item.json.link }}

3 Likes

how, It works! thank.

you made my day!

Actually, in the “edit field” at the loop, I didn’t assign the name of values.

2 Likes

This topic was automatically closed 7 days after the last reply. New replies are no longer allowed.