Skip to content

Instantly share code, notes, and snippets.

@kkdai
Created December 26, 2025 05:10
Show Gist options
  • Select an option

  • Save kkdai/bdd75a33f51262b637b169cfd8ec7913 to your computer and use it in GitHub Desktop.

Select an option

Save kkdai/bdd75a33f51262b637b169cfd8ec7913 to your computer and use it in GitHub Desktop.
{
"nodes": [
{
"parameters": {
"content": "## 📡 RSS 來源區\n\n四個 RSS Feed 來源,每小時檢查一次",
"height": 648,
"width": 300,
"color": 5
},
"type": "n8n-nodes-base.stickyNote",
"typeVersion": 1,
"position": [-480, -64],
"id": "25ae459c-4934-45f1-803e-cd72035e397d",
"name": "Sticky Note - RSS Sources"
},
{
"parameters": {
"content": "## 🔄 資料處理區\n\n統一格式化 JSON 資料",
"height": 760,
"width": 260,
"color": 4
},
"type": "n8n-nodes-base.stickyNote",
"typeVersion": 1,
"position": [-160, -64],
"id": "f4e4eaa9-df16-404b-bdee-2a72d188af3c",
"name": "Sticky Note - Data Processing"
},
{
"parameters": {
"content": "## ✅ 重複檢查區\n\n查詢 Google Sheets 避免重複處理",
"height": 776,
"width": 280,
"color": 2
},
"type": "n8n-nodes-base.stickyNote",
"typeVersion": 1,
"position": [120, -64],
"id": "sticky-dedup-check",
"name": "Sticky Note - Dedup Check"
},
{
"parameters": {
"content": "## 🕷️ 網頁抓取區\n\n使用 Firecrawl 抓取完整網頁內容",
"height": 776,
"width": 260,
"color": 3
},
"type": "n8n-nodes-base.stickyNote",
"typeVersion": 1,
"position": [420, -64],
"id": "15e83fe7-bc0f-4a3b-945d-ecb00a6bf00b",
"name": "Sticky Note - Firecrawl"
},
{
"parameters": {
"content": "## 🤖 AI 摘要區\n\n使用 Gemini 2.5 Flash Lite 產生摘要",
"height": 776,
"width": 300,
"color": 6
},
"type": "n8n-nodes-base.stickyNote",
"typeVersion": 1,
"position": [700, -64],
"id": "9e02cd49-5bdf-423d-a5d0-ed8a68edca10",
"name": "Sticky Note - Gemini"
},
{
"parameters": {
"content": "## 📊 儲存區\n\n寫入 Google Sheets",
"height": 520,
"width": 260,
"color": 7
},
"type": "n8n-nodes-base.stickyNote",
"typeVersion": 1,
"position": [1020, 0],
"id": "61767505-3f05-458a-9585-6188e175d67b",
"name": "Sticky Note - Google Sheets"
},
{
"parameters": {
"pollTimes": {
"item": [{ "mode": "everyHour" }]
},
"feedUrl": "https://blog.gslin.org/feed/"
},
"type": "n8n-nodes-base.rssFeedReadTrigger",
"typeVersion": 1,
"position": [-448, 48],
"id": "cddc21a9-ccd3-4026-b54a-d2875571c8ac",
"name": "GS(DK) RSS"
},
{
"parameters": {
"pollTimes": {
"item": [{ "mode": "everyHour" }]
},
"feedUrl": "https://hnrss.org/best"
},
"type": "n8n-nodes-base.rssFeedReadTrigger",
"typeVersion": 1,
"position": [-448, 192],
"id": "1843907b-4255-4bc3-85dc-feeaf96a3aa0",
"name": "HN Best Story"
},
{
"parameters": {
"pollTimes": {
"item": [{ "mode": "everyHour" }]
},
"feedUrl": "https://steamcommunity.com/groups/freegamesfinders/rss/"
},
"type": "n8n-nodes-base.rssFeedReadTrigger",
"typeVersion": 1,
"position": [-448, 320],
"id": "50cf8ffd-2ee6-4347-a81c-f357598af9e1",
"name": "Steam 限免遊戲"
},
{
"parameters": {
"pollTimes": {
"item": [{ "mode": "everyHour" }]
},
"feedUrl": "https://techblog.lycorp.co.jp/ja/feed/index.xml"
},
"type": "n8n-nodes-base.rssFeedReadTrigger",
"typeVersion": 1,
"position": [-448, 448],
"id": "20dc9251-3c0f-48e0-8483-b80612d7f37a",
"name": "LY Blog (JP)"
},
{
"parameters": {
"assignments": {
"assignments": [
{ "id": "field-title", "name": "title", "value": "={{ $json.title }}", "type": "string" },
{ "id": "field-link", "name": "link", "value": "={{ $json.link }}", "type": "string" },
{ "id": "field-source", "name": "source", "value": "DK", "type": "string" },
{ "id": "field-created", "name": "created_at", "value": "={{ $json.pubDate }}", "type": "string" }
]
},
"options": {}
},
"type": "n8n-nodes-base.set",
"typeVersion": 3.4,
"position": [-112, 48],
"id": "e096a793-9b66-4e0f-968e-3cc1932b71b6",
"name": "Format DK"
},
{
"parameters": {
"assignments": {
"assignments": [
{ "id": "field-title", "name": "title", "value": "={{ $json.title }}", "type": "string" },
{ "id": "field-link", "name": "link", "value": "={{ $json.link }}", "type": "string" },
{ "id": "field-source", "name": "source", "value": "HN", "type": "string" },
{ "id": "field-created", "name": "created_at", "value": "={{ $json.pubDate }}", "type": "string" }
]
},
"options": {}
},
"type": "n8n-nodes-base.set",
"typeVersion": 3.4,
"position": [-112, 192],
"id": "588bbeb0-9819-4e87-8e9a-c05065d5f863",
"name": "Format HN"
},
{
"parameters": {
"assignments": {
"assignments": [
{ "id": "field-title", "name": "title", "value": "={{ $json.title }}", "type": "string" },
{ "id": "field-link", "name": "link", "value": "={{ $json.link }}", "type": "string" },
{ "id": "field-source", "name": "source", "value": "Steam", "type": "string" },
{ "id": "field-created", "name": "created_at", "value": "={{ $json.pubDate }}", "type": "string" }
]
},
"options": {}
},
"type": "n8n-nodes-base.set",
"typeVersion": 3.4,
"position": [-112, 352],
"id": "8b948438-d530-4e30-a31d-e8c748bf2459",
"name": "Format Steam"
},
{
"parameters": {
"assignments": {
"assignments": [
{ "id": "field-title", "name": "title", "value": "={{ $json.title }}", "type": "string" },
{ "id": "field-link", "name": "link", "value": "={{ $json.link }}", "type": "string" },
{ "id": "field-source", "name": "source", "value": "LY Blog", "type": "string" },
{ "id": "field-created", "name": "created_at", "value": "={{ $json.pubDate }}", "type": "string" }
]
},
"options": {}
},
"type": "n8n-nodes-base.set",
"typeVersion": 3.4,
"position": [-112, 544],
"id": "88f68046-b2ed-49c4-82e7-606d212ece17",
"name": "Format LY"
},
{
"parameters": {
"operation": "search",
"documentId": {
"__rl": true,
"value": "YOUR_GOOGLE_SHEETS_ID",
"mode": "list",
"cachedResultName": "YOUR_SHEET_NAME",
"cachedResultUrl": "https://docs.google.com/spreadsheets/d/YOUR_GOOGLE_SHEETS_ID/edit"
},
"sheetName": {
"__rl": true,
"value": "YOUR_SHEET_GID",
"mode": "list",
"cachedResultName": "RSS_Feeds",
"cachedResultUrl": "https://docs.google.com/spreadsheets/d/YOUR_GOOGLE_SHEETS_ID/edit#gid=YOUR_SHEET_GID"
},
"filtersUI": {
"values": [
{ "lookupColumn": "link", "lookupValue": "={{ $json.link }}" }
]
},
"options": {}
},
"type": "n8n-nodes-base.googleSheets",
"typeVersion": 4.5,
"position": [168, 288],
"id": "check-duplicate-sheets",
"name": "Check Duplicate",
"credentials": {
"googleSheetsOAuth2Api": {
"id": "YOUR_CREDENTIAL_ID",
"name": "Google Sheets account"
}
}
},
{
"parameters": {
"conditions": {
"options": {
"caseSensitive": true,
"leftValue": "",
"typeValidation": "strict"
},
"conditions": [
{
"id": "condition-is-new",
"leftValue": "={{ $json.link }}",
"rightValue": "",
"operator": { "type": "string", "operation": "empty", "singleValue": true }
}
],
"combinator": "and"
},
"options": {}
},
"type": "n8n-nodes-base.if",
"typeVersion": 2.2,
"position": [168, 528],
"id": "filter-new-items",
"name": "Is New Article?"
},
{
"parameters": {
"method": "POST",
"url": "https://api.firecrawl.dev/v2/scrape",
"authentication": "genericCredentialType",
"genericAuthType": "httpHeaderAuth",
"sendBody": true,
"specifyBody": "json",
"jsonBody": "={\n \"url\": \"{{ $('Aggregate Items').item.json.link }}\",\n \"onlyMainContent\": false,\n \"maxAge\": 172800000,\n \"parsers\": [\"pdf\"],\n \"formats\": [\"markdown\"]\n}",
"options": {}
},
"type": "n8n-nodes-base.httpRequest",
"typeVersion": 4.2,
"position": [516, 64],
"id": "c8982749-d970-44c3-aac6-b13e1baef38e",
"name": "Firecrawl Scrape",
"credentials": {
"httpHeaderAuth": {
"id": "YOUR_FIRECRAWL_CREDENTIAL_ID",
"name": "Firecrawl API Key"
}
}
},
{
"parameters": {
"assignments": {
"assignments": [
{ "id": "merge-title", "name": "title", "value": "={{ $json.data.metadata.title }}", "type": "string" },
{ "id": "merge-link", "name": "link", "value": "={{ $json.data.metadata.sourceURL }}", "type": "string" },
{ "id": "merge-source", "name": "source", "value": "={{ $('Aggregate Items').item.json.source }}", "type": "string" },
{ "id": "merge-created", "name": "created_at", "value": "={{ $json.data.metadata.cachedAt }}", "type": "string" },
{ "id": "merge-content", "name": "content", "value": "={{ $json.data.markdown }}", "type": "string" }
]
},
"options": {}
},
"type": "n8n-nodes-base.set",
"typeVersion": 3.4,
"position": [516, 320],
"id": "6cc186c4-1ced-492a-9017-bf4d6c117f51",
"name": "Merge Data"
},
{
"parameters": {
"method": "POST",
"url": "https://generativelanguage.googleapis.com/v1beta/models/gemini-2.5-flash-lite-preview-06-17:generateContent",
"authentication": "genericCredentialType",
"genericAuthType": "httpHeaderAuth",
"sendBody": true,
"specifyBody": "json",
"jsonBody": "={\n \"contents\": [\n {\n \"parts\": [\n {\n \"text\": {{ JSON.stringify($json.prompt) }}\n }\n ]\n }\n ],\n \"generationConfig\": {\n \"temperature\": 0.7,\n \"maxOutputTokens\": 512\n }\n}",
"options": {}
},
"type": "n8n-nodes-base.httpRequest",
"typeVersion": 4.2,
"position": [796, 304],
"id": "649a5bca-b267-4035-8be2-0593b6587086",
"name": "Gemini Summarize",
"credentials": {
"httpHeaderAuth": {
"id": "YOUR_GEMINI_CREDENTIAL_ID",
"name": "Gemini API Key"
}
}
},
{
"parameters": {
"assignments": {
"assignments": [
{ "id": "final-title", "name": "title", "value": "={{ $('網頁內容預處理').item.json.title }}", "type": "string" },
{ "id": "final-link", "name": "link", "value": "={{ $('網頁內容預處理').item.json.link }}", "type": "string" },
{ "id": "final-summary", "name": "summary", "value": "={{ $json.candidates[0].content.parts[0].text }}", "type": "string" },
{ "id": "final-source", "name": "source", "value": "={{ $('網頁內容預處理').item.json.source }}", "type": "string" },
{ "id": "final-created", "name": "created_at", "value": "={{ $('網頁內容預處理').item.json.created_at }}", "type": "string" },
{ "id": "final-sent", "name": "sent", "value": "FALSE", "type": "string" }
]
},
"options": {}
},
"type": "n8n-nodes-base.set",
"typeVersion": 3.4,
"position": [796, 544],
"id": "ada5178a-97e6-4a97-8652-6061b955e7b7",
"name": "Prepare Sheets Data"
},
{
"parameters": {
"operation": "appendOrUpdate",
"documentId": {
"__rl": true,
"value": "YOUR_GOOGLE_SHEETS_ID",
"mode": "list",
"cachedResultName": "YOUR_SHEET_NAME",
"cachedResultUrl": "https://docs.google.com/spreadsheets/d/YOUR_GOOGLE_SHEETS_ID/edit"
},
"sheetName": {
"__rl": true,
"value": "YOUR_SHEET_GID",
"mode": "list",
"cachedResultName": "RSS_Feeds",
"cachedResultUrl": "https://docs.google.com/spreadsheets/d/YOUR_GOOGLE_SHEETS_ID/edit#gid=YOUR_SHEET_GID"
},
"columns": {
"mappingMode": "defineBelow",
"value": {
"link": "={{ $json.link }}",
"summary": "={{ $json.summary }}",
"source": "={{ $json.source }}",
"created_at": "={{ $json.created_at }}",
"sent": "={{ $json.sent }}"
},
"matchingColumns": ["link"],
"schema": [
{ "id": "link", "displayName": "link", "required": false, "defaultMatch": false, "display": true, "type": "string", "canBeUsedToMatch": true, "removed": false },
{ "id": "summary", "displayName": "summary", "required": false, "defaultMatch": false, "display": true, "type": "string", "canBeUsedToMatch": true, "removed": false },
{ "id": "source", "displayName": "source", "required": false, "defaultMatch": false, "display": true, "type": "string", "canBeUsedToMatch": true, "removed": false },
{ "id": "created_at", "displayName": "created_at", "required": false, "defaultMatch": false, "display": true, "type": "string", "canBeUsedToMatch": true, "removed": false },
{ "id": "sent", "displayName": "sent", "required": false, "defaultMatch": false, "display": true, "type": "string", "canBeUsedToMatch": true, "removed": false }
],
"attemptToConvertTypes": false,
"convertFieldsToString": false
},
"options": {}
},
"type": "n8n-nodes-base.googleSheets",
"typeVersion": 4.5,
"position": [1100, 256],
"id": "f18204e8-c4a4-46eb-bf54-0a8f3b88db6e",
"name": "Append to Google Sheets",
"credentials": {
"googleSheetsOAuth2Api": {
"id": "YOUR_CREDENTIAL_ID",
"name": "Google Sheets account"
}
}
},
{
"parameters": {
"jsCode": "const items = $input.all();\nconst maxLen = 1500;\n\nconst newItems = items.map(item => {\n const title = item.json.title || '';\n const raw = item.json.content || '';\n\n // 1. 移除圖片、Base64、URL、程式碼區塊等雜訊\n let text = raw\n .replace(/```[\\s\\S]*?```/g, '') // 移除程式碼區塊\n .replace(/`[^`]+`/g, '') // 移除行內程式碼\n .replace(/!\\[[^\\]]*\\]\\([^)]*\\)/g, '') // 移除 markdown 圖片\n .replace(/<[^>]+>/g, '') // 移除 HTML 標籤\n .replace(/<Base64-Image-Removed>/g, '') // 移除 base64 佔位\n .replace(/https?:\\/\\/\\S+/g, '') // 移除 URL\n .replace(/\\[[^\\]]*?\\]\\(\\s*\\)/g, '') // 移除空的 link\n .replace(/\\[([^\\]]+)\\]\\([^)]+\\)/g, '$1') // 保留連結文字,移除連結\n .replace(/[#>*`|_~]/g, '') // 移除 markdown 特殊字元\n .replace(/\\n{3,}/g, '\\n\\n') // 多換行壓成兩個\n .replace(/\\s{2,}/g, ' ') // 多空白壓成一個\n .trim();\n\n // 2. 切掉留言區 / 側欄 / 頁尾等無關內容\n const cutPatterns = [\n 'Leave a Reply',\n 'Recent Comments',\n 'Related Posts',\n 'Share this',\n 'Comments',\n 'Subscribe',\n 'Newsletter',\n 'Footer',\n 'Copyright',\n '關於作者',\n '延伸閱讀',\n '相關文章',\n '留言'\n ];\n \n for (const pattern of cutPatterns) {\n const idx = text.indexOf(pattern);\n if (idx > 200) {\n text = text.slice(0, idx);\n }\n }\n\n // 3. 只保留前 N 個字元\n text = text.slice(0, maxLen);\n\n // 4. 如果文字被截斷,找到最後一個完整句子\n if (text.length === maxLen) {\n const lastPeriod = Math.max(\n text.lastIndexOf('。'),\n text.lastIndexOf('!'),\n text.lastIndexOf('?'),\n text.lastIndexOf('. '),\n text.lastIndexOf('! '),\n text.lastIndexOf('? ')\n );\n if (lastPeriod > maxLen * 0.5) {\n text = text.slice(0, lastPeriod + 1);\n }\n }\n\n // 5. 組成精簡的 prompt\n const prompt = `用繁體中文寫100字以內摘要,只輸出摘要正文:\\n\\n標題:${title}\\n\\n內容:\\n${text}`;\n\n return {\n json: {\n ...item.json,\n prompt: prompt\n }\n };\n});\n\nreturn newItems;"
},
"type": "n8n-nodes-base.code",
"typeVersion": 2,
"position": [796, 64],
"id": "e79db73f-724b-499a-af4b-8132d226d143",
"name": "網頁內容預處理"
},
{
"parameters": {
"aggregate": "aggregateAllItemData",
"options": {}
},
"type": "n8n-nodes-base.aggregate",
"typeVersion": 1,
"position": [168, 48],
"id": "aggregate-all-rss",
"name": "Aggregate Items"
},
{
"parameters": {
"mode": "combineBySql",
"query": "SELECT * FROM input1 LEFT JOIN input2 ON input1.link = input2.link",
"options": {}
},
"type": "n8n-nodes-base.merge",
"typeVersion": 3.2,
"position": [516, 576],
"id": "32f5fa16-9e55-43ef-bce6-2fbf109e5407",
"name": "Merge"
}
],
"connections": {
"GS(DK) RSS": {
"main": [[{ "node": "Format DK", "type": "main", "index": 0 }]]
},
"HN Best Story": {
"main": [[{ "node": "Format HN", "type": "main", "index": 0 }]]
},
"Steam 限免遊戲": {
"main": [[{ "node": "Format Steam", "type": "main", "index": 0 }]]
},
"LY Blog (JP)": {
"main": [[{ "node": "Format LY", "type": "main", "index": 0 }]]
},
"Format DK": {
"main": [[{ "node": "Aggregate Items", "type": "main", "index": 0 }]]
},
"Format HN": {
"main": [[{ "node": "Aggregate Items", "type": "main", "index": 0 }]]
},
"Format Steam": {
"main": [[{ "node": "Aggregate Items", "type": "main", "index": 0 }]]
},
"Format LY": {
"main": [[{ "node": "Aggregate Items", "type": "main", "index": 0 }]]
},
"Aggregate Items": {
"main": [[{ "node": "Check Duplicate", "type": "main", "index": 0 }]]
},
"Check Duplicate": {
"main": [[{ "node": "Is New Article?", "type": "main", "index": 0 }]]
},
"Is New Article?": {
"main": [
[
{ "node": "Firecrawl Scrape", "type": "main", "index": 0 },
{ "node": "Merge", "type": "main", "index": 1 }
],
[]
]
},
"Firecrawl Scrape": {
"main": [[{ "node": "Merge Data", "type": "main", "index": 0 }]]
},
"Merge Data": {
"main": [[{ "node": "Merge", "type": "main", "index": 0 }]]
},
"Merge": {
"main": [[{ "node": "網頁內容預處理", "type": "main", "index": 0 }]]
},
"網頁內容預處理": {
"main": [[{ "node": "Gemini Summarize", "type": "main", "index": 0 }]]
},
"Gemini Summarize": {
"main": [[{ "node": "Prepare Sheets Data", "type": "main", "index": 0 }]]
},
"Prepare Sheets Data": {
"main": [[{ "node": "Append to Google Sheets", "type": "main", "index": 0 }]]
}
},
"pinData": {},
"meta": {
"templateCredsSetupCompleted": true
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment