{
  "id": "jfVkCl4jNOIECJM7",
  "name": "Aggregate Hacker News, TechCrunch and YouTube Trending to n8n Data Table Daily (Collector, Run This First)",
  "tags": [],
  "nodes": [
    {
      "id": "bf6a182a-990d-4825-b917-c7b7b97a32a4",
      "name": "Sticky Note",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        -304,
        -128
      ],
      "parameters": {
        "width": 480,
        "height": 880,
        "content": "## Aggregate Hacker News, TechCrunch and YouTube Trending to n8n Data Table Daily (Collector, Run This First)\n\n### How it works\n\n1. Triggers every day at 12 am and 8 am PT to start the data collection process.\n2. Deletes today's existing data from the data table to ensure freshness.\n3. Fetches top stories from Hacker News, limits them, and normalizes the data.\n4. Fetches articles from TechCrunch, limits the number, and normalizes it.\n5. Collects trending videos from YouTube, normalizes the data, and stores results in the data table.\n\n### Setup steps\n\n- [ ] Configure the schedule trigger to set local time for your region if needed.\n- [ ] Set up API credentials for Hacker News, TechCrunch, and YouTube.\n- [ ] Ensure data table nodes are properly linked with your database or storage.\n\n### Customization\n\nThe schedule times and data sources (Hacker News, TechCrunch, YouTube) can be customized to suit your specific needs."
      },
      "typeVersion": 1
    },
    {
      "id": "cdaebe0e-77ee-4948-9881-88e5c2be72e7",
      "name": "Sticky Note1",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        256,
        48
      ],
      "parameters": {
        "color": 7,
        "width": 416,
        "height": 304,
        "content": "## Trigger and initialize\n\nInitial trigger to start the workflow and clear existing data."
      },
      "typeVersion": 1
    },
    {
      "id": "c4702efb-c14e-44c9-89bf-d63489f69256",
      "name": "Sticky Note2",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        704,
        -128
      ],
      "parameters": {
        "color": 7,
        "width": 1088,
        "height": 272,
        "content": "## Fetch Hacker News data\n\nFetches and processes top stories from Hacker News."
      },
      "typeVersion": 1
    },
    {
      "id": "31951b5c-bce4-4a26-89be-af102095e387",
      "name": "Sticky Note3",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        704,
        176
      ],
      "parameters": {
        "color": 7,
        "width": 864,
        "height": 272,
        "content": "## Fetch TechCrunch data\n\nRetrieves TechCrunch articles and manages data constraints."
      },
      "typeVersion": 1
    },
    {
      "id": "e02d9067-e753-4ec5-a742-b8c0e953b081",
      "name": "Sticky Note4",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        704,
        480
      ],
      "parameters": {
        "color": 7,
        "width": 640,
        "height": 272,
        "content": "## Fetch YouTube Trends\n\nFetches YouTube trending videos in the tech category."
      },
      "typeVersion": 1
    },
    {
      "id": "607e018c-d760-40ce-91c6-19326280c222",
      "name": "When Daily at 12am & 8am PT",
      "type": "n8n-nodes-base.scheduleTrigger",
      "position": [
        304,
        176
      ],
      "parameters": {
        "rule": {
          "interval": [
            {},
            {
              "triggerAtHour": 8
            }
          ]
        }
      },
      "typeVersion": 1.3
    },
    {
      "id": "5cb13d53-f70e-4256-8818-f3602596c8bc",
      "name": "Clear Today's Data Table",
      "type": "n8n-nodes-base.dataTable",
      "position": [
        528,
        176
      ],
      "parameters": {
        "filters": {
          "conditions": [
            {
              "keyName": "date",
              "keyValue": "=2026-07-22"
            }
          ]
        },
        "options": {},
        "operation": "deleteRows",
        "dataTableId": {
          "__rl": true,
          "mode": "name",
          "value": "tech_trends"
        }
      },
      "typeVersion": 1.1,
      "alwaysOutputData": true
    },
    {
      "id": "f171a72d-f697-4d9b-823a-593f85bdc210",
      "name": "Fetch Top HN Story IDs",
      "type": "n8n-nodes-base.httpRequest",
      "position": [
        752,
        -16
      ],
      "parameters": {
        "url": "https://hacker-news.firebaseio.com/v0/topstories.json",
        "options": {}
      },
      "executeOnce": true,
      "typeVersion": 4.3
    },
    {
      "id": "70b36395-ecf1-4d91-aec7-0e3c3dd3d8fe",
      "name": "Select Top 20 HN IDs",
      "type": "n8n-nodes-base.code",
      "position": [
        976,
        -16
      ],
      "parameters": {
        "jsCode": "const all = $input.all();\nconst ids = all.map(function(i) { return i.json; });\nreturn ids.slice(0, 20).map(function(id, idx) {\n  return { json: { hn_id: String(id), rank: idx + 1 } };\n});"
      },
      "typeVersion": 2
    },
    {
      "id": "ff4cf3c7-87b0-4406-975c-57011aa77e89",
      "name": "Fetch HN Story Details",
      "type": "n8n-nodes-base.httpRequest",
      "position": [
        1200,
        -16
      ],
      "parameters": {
        "url": "=https://hacker-news.firebaseio.com/v0/item/.json",
        "options": {}
      },
      "typeVersion": 4.3
    },
    {
      "id": "3ebe70f0-bf08-4a7e-827e-2dcf6ffb5a6b",
      "name": "Normalize HN Data",
      "type": "n8n-nodes-base.code",
      "position": [
        1424,
        -16
      ],
      "parameters": {
        "jsCode": "const items = $input.all();\nconst today = new Date().toISOString().split(\"T\")[0];\nconst result = [];\nfor (let i = 0; i < items.length; i++) {\n  const s = items[i].json;\n  if (!s || !s.title) continue;\n  result.push({ json: {\n    date: today,\n    source: \"hackernews\",\n    title: s.title,\n    url: s.url || (\"https://news.ycombinator.com/item?id=\" + s.id),\n    score: s.score || 0,\n    rank: i + 1\n  } });\n}\nreturn result;"
      },
      "typeVersion": 2
    },
    {
      "id": "484571d7-b59b-460a-957b-3ca1e3b8ff96",
      "name": "Insert HN Data",
      "type": "n8n-nodes-base.dataTable",
      "position": [
        1648,
        -16
      ],
      "parameters": {
        "columns": {
          "value": {
            "url": "=",
            "date": "=",
            "rank": "=",
            "score": "=",
            "title": "=",
            "source": "="
          },
          "schema": [
            {
              "id": "date",
              "type": "string",
              "display": true,
              "required": false,
              "displayName": "date",
              "defaultMatch": false,
              "canBeUsedToMatch": false
            },
            {
              "id": "source",
              "type": "string",
              "display": true,
              "required": false,
              "displayName": "source",
              "defaultMatch": false,
              "canBeUsedToMatch": false
            },
            {
              "id": "title",
              "type": "string",
              "display": true,
              "required": false,
              "displayName": "title",
              "defaultMatch": false,
              "canBeUsedToMatch": false
            },
            {
              "id": "url",
              "type": "string",
              "display": true,
              "required": false,
              "displayName": "url",
              "defaultMatch": false,
              "canBeUsedToMatch": false
            },
            {
              "id": "score",
              "type": "number",
              "display": true,
              "required": false,
              "displayName": "score",
              "defaultMatch": false,
              "canBeUsedToMatch": false
            },
            {
              "id": "rank",
              "type": "number",
              "display": true,
              "required": false,
              "displayName": "rank",
              "defaultMatch": false,
              "canBeUsedToMatch": false
            }
          ],
          "mappingMode": "defineBelow"
        },
        "options": {},
        "dataTableId": {
          "__rl": true,
          "mode": "name",
          "value": "tech_trends"
        }
      },
      "typeVersion": 1.1
    },
    {
      "id": "ace080b1-45a8-48bd-953e-41436553a9eb",
      "name": "Fetch TechCrunch RSS Feed",
      "type": "n8n-nodes-base.rssFeedRead",
      "position": [
        752,
        288
      ],
      "parameters": {
        "url": "https://techcrunch.com/feed/",
        "options": {}
      },
      "executeOnce": true,
      "typeVersion": 1.2
    },
    {
      "id": "57e74e87-7c02-40bf-9734-61cf845356e8",
      "name": "Limit to 15 TechCrunch Articles",
      "type": "n8n-nodes-base.limit",
      "position": [
        976,
        288
      ],
      "parameters": {
        "maxItems": 15
      },
      "typeVersion": 1
    },
    {
      "id": "7ef7e41b-4fd6-4c3c-a265-e4258eaec6c4",
      "name": "Normalize TechCrunch Data",
      "type": "n8n-nodes-base.code",
      "position": [
        1200,
        288
      ],
      "parameters": {
        "jsCode": "const items = $input.all();\nconst today = new Date().toISOString().split(\"T\")[0];\nreturn items.map(function(item, i) {\n  return { json: {\n    date: today,\n    source: \"techcrunch\",\n    title: item.json.title || \"\",\n    url: item.json.link || \"\",\n    score: 0,\n    rank: i + 1\n  } };\n});"
      },
      "typeVersion": 2
    },
    {
      "id": "f06c6207-75af-4f7b-94e2-40ad677c26fd",
      "name": "Insert TechCrunch Data",
      "type": "n8n-nodes-base.dataTable",
      "position": [
        1424,
        288
      ],
      "parameters": {
        "columns": {
          "value": {
            "url": "=",
            "date": "=",
            "rank": "=",
            "score": "=",
            "title": "=",
            "source": "="
          },
          "schema": [
            {
              "id": "date",
              "type": "string",
              "display": true,
              "required": false,
              "displayName": "date",
              "defaultMatch": false,
              "canBeUsedToMatch": false
            },
            {
              "id": "source",
              "type": "string",
              "display": true,
              "required": false,
              "displayName": "source",
              "defaultMatch": false,
              "canBeUsedToMatch": false
            },
            {
              "id": "title",
              "type": "string",
              "display": true,
              "required": false,
              "displayName": "title",
              "defaultMatch": false,
              "canBeUsedToMatch": false
            },
            {
              "id": "url",
              "type": "string",
              "display": true,
              "required": false,
              "displayName": "url",
              "defaultMatch": false,
              "canBeUsedToMatch": false
            },
            {
              "id": "score",
              "type": "number",
              "display": true,
              "required": false,
              "displayName": "score",
              "defaultMatch": false,
              "canBeUsedToMatch": false
            },
            {
              "id": "rank",
              "type": "number",
              "display": true,
              "required": false,
              "displayName": "rank",
              "defaultMatch": false,
              "canBeUsedToMatch": false
            }
          ],
          "mappingMode": "defineBelow"
        },
        "options": {},
        "dataTableId": {
          "__rl": true,
          "mode": "name",
          "value": "tech_trends"
        }
      },
      "typeVersion": 1.1
    },
    {
      "id": "e01ab114-062f-4a54-8319-e2ff778f700f",
      "name": "Fetch YouTube Trending",
      "type": "n8n-nodes-base.httpRequest",
      "position": [
        752,
        592
      ],
      "parameters": {
        "url": "https://www.googleapis.com/youtube/v3/videos",
        "options": {},
        "sendQuery": true,
        "authentication": "genericCredentialType",
        "genericAuthType": "httpQueryAuth",
        "queryParameters": {
          "parameters": [
            {
              "name": "part",
              "value": "snippet,statistics"
            },
            {
              "name": "chart",
              "value": "mostPopular"
            },
            {
              "name": "videoCategoryId",
              "value": "28"
            },
            {
              "name": "regionCode",
              "value": "US"
            },
            {
              "name": "maxResults",
              "value": "15"
            }
          ]
        }
      },
      "executeOnce": true,
      "typeVersion": 4.3
    },
    {
      "id": "fb8ca896-b4e6-46ae-b68d-187d3317c8ba",
      "name": "Normalize YouTube Data",
      "type": "n8n-nodes-base.code",
      "position": [
        976,
        592
      ],
      "parameters": {
        "jsCode": "const resp = $input.first().json;\nconst videos = resp.items || [];\nconst today = new Date().toISOString().split(\"T\")[0];\nreturn videos.map(function(v, i) {\n  return { json: {\n    date: today,\n    source: \"youtube\",\n    title: v.snippet.title,\n    url: \"https://www.youtube.com/watch?v=\" + v.id,\n    score: parseInt((v.statistics && v.statistics.viewCount) || \"0\", 10),\n    rank: i + 1\n  } };\n});"
      },
      "typeVersion": 2
    },
    {
      "id": "0f885349-59d3-45f0-9b14-8b25ae41f4cc",
      "name": "Insert YouTube Data",
      "type": "n8n-nodes-base.dataTable",
      "position": [
        1200,
        592
      ],
      "parameters": {
        "columns": {
          "value": {
            "url": "=",
            "date": "=",
            "rank": "=",
            "score": "=",
            "title": "=",
            "source": "="
          },
          "schema": [
            {
              "id": "date",
              "type": "string",
              "display": true,
              "required": false,
              "displayName": "date",
              "defaultMatch": false,
              "canBeUsedToMatch": false
            },
            {
              "id": "source",
              "type": "string",
              "display": true,
              "required": false,
              "displayName": "source",
              "defaultMatch": false,
              "canBeUsedToMatch": false
            },
            {
              "id": "title",
              "type": "string",
              "display": true,
              "required": false,
              "displayName": "title",
              "defaultMatch": false,
              "canBeUsedToMatch": false
            },
            {
              "id": "url",
              "type": "string",
              "display": true,
              "required": false,
              "displayName": "url",
              "defaultMatch": false,
              "canBeUsedToMatch": false
            },
            {
              "id": "score",
              "type": "number",
              "display": true,
              "required": false,
              "displayName": "score",
              "defaultMatch": false,
              "canBeUsedToMatch": false
            },
            {
              "id": "rank",
              "type": "number",
              "display": true,
              "required": false,
              "displayName": "rank",
              "defaultMatch": false,
              "canBeUsedToMatch": false
            }
          ],
          "mappingMode": "defineBelow"
        },
        "options": {},
        "dataTableId": {
          "__rl": true,
          "mode": "name",
          "value": "tech_trends"
        }
      },
      "typeVersion": 1.1
    }
  ],
  "active": false,
  "settings": {
    "binaryMode": "separate",
    "executionOrder": "v1"
  },
  "versionId": "b4723407-826d-4918-a69c-d37c6317b2e0",
  "nodeGroups": [],
  "connections": {
    "Normalize HN Data": {
      "main": [
        [
          {
            "node": "Insert HN Data",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Select Top 20 HN IDs": {
      "main": [
        [
          {
            "node": "Fetch HN Story Details",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Fetch HN Story Details": {
      "main": [
        [
          {
            "node": "Normalize HN Data",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Fetch Top HN Story IDs": {
      "main": [
        [
          {
            "node": "Select Top 20 HN IDs",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Fetch YouTube Trending": {
      "main": [
        [
          {
            "node": "Normalize YouTube Data",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Normalize YouTube Data": {
      "main": [
        [
          {
            "node": "Insert YouTube Data",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Clear Today's Data Table": {
      "main": [
        [
          {
            "node": "Fetch Top HN Story IDs",
            "type": "main",
            "index": 0
          },
          {
            "node": "Fetch TechCrunch RSS Feed",
            "type": "main",
            "index": 0
          },
          {
            "node": "Fetch YouTube Trending",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Fetch TechCrunch RSS Feed": {
      "main": [
        [
          {
            "node": "Limit to 15 TechCrunch Articles",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Normalize TechCrunch Data": {
      "main": [
        [
          {
            "node": "Insert TechCrunch Data",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "When Daily at 12am & 8am PT": {
      "main": [
        [
          {
            "node": "Clear Today's Data Table",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Limit to 15 TechCrunch Articles": {
      "main": [
        [
          {
            "node": "Normalize TechCrunch Data",
            "type": "main",
            "index": 0
          }
        ]
      ]
    }
  }
}