2025/03/16改版

image.png

4.png

  1. 定時觸發 (Weekly Trigger)
  2. 獲取 Notion 資料 (Get Existing Records)
  3. 計算時間範圍 (Generate Week Range)
  4. 獲取 GitHub 每週熱門專案 (Fetch Weekly Repos)
  5. 格式化輸出 (Format Output)
  6. 批次處理 (SplitInBatches)
  7. 過濾是否已存在 (Filter Unique Records)
  8. 爬取專案網頁內容 (FireCrawl)
  9. 生成 AI 內容摘要 (OpenAI)
  10. 將結果存入 Notion (Add New Record to Notion)

這個流程基本上是將 GitHub 熱門專案 → 資料整理 → AI 生成摘要 → Notion 儲存,達到完全自動化的每週報告。


安裝FIRECRAWL

點選該項目後註冊

https://www.firecrawl.dev/

註冊完畢點選

image.png

image.png

複製你的api之後到N8N裡面安裝https://www.npmjs.com/package/n8n-nodes-firecrawl該項目 在設定裡面


參考資料

https://www.firecrawl.dev/

https://community.n8n.io/t/n8n-community-node-firecrawl/55546

https://www.npmjs.com/package/n8n-nodes-firecrawl

巴斯廣告

訂閱我的巴斯報

https://www.instagram.com/bath_helloword/

https://www.youtube.com/@巴斯-c1e

{
  "nodes": [
    {
      "parameters": {
        "resource": "chat",
        "model": "={{ $('Get Existing Records').item.json.properties['模型'].select.name }}",
        "prompt": {
          "messages": [
            {
              "role": "system",
              "content": "={{ $('Get Existing Records').item.json.properties['要求'].multi_select[0].name }}"
            },
            {
              "content": "={{ $json.data.markdown }}"
            },
            {
              "role": "assistant",
              "content": "={{ $('Get Existing Records').item.json.properties['要求GPT扮演的角色'].select.name }}"
            }
          ]
        },
        "options": {
          "maxTokens": 2048,
          "temperature": 1
        },
        "requestOptions": {}
      },
      "id": "84c2f473-9e4b-4e44-beaf-2ae6e7fbd7c0",
      "name": "OpenAI",
      "type": "n8n-nodes-base.openAi",
      "typeVersion": 1,
      "position": [
        400,
        540
      ],
      "alwaysOutputData": false,
      "credentials": {
        "openAiApi": {
          "id": "TGvBBQW4GjfEnddu",
          "name": "OpenAi account"
        }
      }
    },
    {
      "parameters": {
        "options": {
          "reset": true
        }
      },
      "name": "SplitInBatches",
      "type": "n8n-nodes-base.splitInBatches",
      "typeVersion": 1,
      "position": [
        -280,
        540
      ],
      "id": "60c931ab-0be4-4d38-977a-88366e114a3e"
    },
    {
      "parameters": {
        "resource": "databasePage",
        "operation": "getAll",
        "databaseId": {
          "__rl": true,
          "value": "182d3705-f69e-8053-9d5a-ea5b03411e09",
          "mode": "list",
          "cachedResultName": "giphub每周熱點",
          "cachedResultUrl": "<https://www.notion.so/182d3705f69e80539d5aea5b03411e09>"
        },
        "returnAll": true,
        "simple": false,
        "filterType": "manual",
        "filters": {
          "conditions": [
            {
              "key": "姓名|rich_text",
              "condition": "equals",
              "richTextValue": "123"
            }
          ]
        },
        "options": {}
      },
      "name": "Get Existing Records",
      "type": "n8n-nodes-base.notion",
      "typeVersion": 2,
      "position": [
        -260,
        300
      ],
      "id": "7e025c5f-b5ae-45a2-9fd3-ba777a0d8153",
      "executeOnce": true,
      "credentials": {
        "notionApi": {
          "id": "mLkW1oHj5qZYbd3M",
          "name": "Notion account"
        }
      }
    },
    {
      "parameters": {
        "conditions": {
          "string": [
            {
              "value1": "={{ $json[\\"URL\\"] }}",
              "operation": "notContains",
              "value2": "={{ $('Get Existing Records').item.json.properties['姓名'].rich_text[0].plain_text }}"
            }
          ]
        }
      },
      "name": "Filter Unique Records",
      "type": "n8n-nodes-base.if",
      "typeVersion": 1,
      "position": [
        -40,
        540
      ],
      "id": "28a83b64-5b73-48e8-84d0-ef4ee1081522"
    },
    {
      "parameters": {
        "resource": "databasePage",
        "databaseId": {
          "__rl": true,
          "value": "182d3705-f69e-8053-9d5a-ea5b03411e09",
          "mode": "list",
          "cachedResultName": "giphub每周熱點",
          "cachedResultUrl": "<https://www.notion.so/182d3705f69e80539d5aea5b03411e09>"
        },
        "title": "=影片",
        "propertiesUi": {
          "propertyValues": [
            {
              "key": "網址|rich_text",
              "textContent": "={{ $('Format Output').item.json.url }}"
            },
            {
              "key": "描述|rich_text",
              "textContent": "={{ $('Format Output').item.json.description ? $('Format Output').item.json.description : '該檔案沒有描述' }}\\n"
            },
            {
              "key": "姓名|rich_text",
              "textContent": "={{ $('SplitInBatches').item.json.name }}"
            },
            {
              "key": "GPT輸出|rich_text",
              "textContent": "={{ $('OpenAI').item.json.message.content.length > 2000 ? $('OpenAI').item.json.message.content.substring(0, 2000) : $('OpenAI').item.json.message.content }}\\n"
            },
            {
              "key": "time|rich_text",
              "textContent": "={{ $('Generate Week Range').item.json.startDate }}-{{ $('Generate Week Range').item.json.endDate }}"
            },
            {
              "key": "⭐⭐|rich_text",
              "textContent": "={{ $('Format Output').item.json.stars.toString() }}\\n"
            }
          ]
        },
        "options": {}
      },
      "name": "Add New Record to Notion",
      "type": "n8n-nodes-base.notion",
      "typeVersion": 2,
      "position": [
        640,
        540
      ],
      "id": "2b2bb6e9-2715-454c-af48-29816540d524",
      "credentials": {
        "notionApi": {
          "id": "mLkW1oHj5qZYbd3M",
          "name": "Notion account"
        }
      }
    },
    {
      "parameters": {
        "functionCode": "const now = new Date();\\nconst endDate = new Date(now.setDate(now.getDate() - now.getDay() - 1)); // 上周日\\nconst startDate = new Date(endDate);\\nstartDate.setDate(endDate.getDate() - 6); // 上周一\\n\\nconst start = startDate.toISOString().split('T')[0];\\nconst end = endDate.toISOString().split('T')[0];\\n\\n// 返回開始和結束日期以及完整的 URL\\nreturn [\\n  {\\n    json: {\\n      startDate: start,\\n      endDate: end,\\n      queryUrl: `https://api.github.com/search/repositories?q=stars:>0+created:${start}..${end}&sort=stars&order=desc&per_page=10`,\\n    },\\n  },\\n];"
      },
      "name": "Generate Week Range",
      "type": "n8n-nodes-base.function",
      "typeVersion": 1,
      "position": [
        -40,
        300
      ],
      "id": "ef0af992-7c48-42f1-90b0-bfe7f188aa11"
    },
    {
      "parameters": {
        "url": "={{$json[\\"queryUrl\\"]}}",
        "allowUnauthorizedCerts": true,
        "options": {}
      },
      "name": "Fetch Weekly Repos",
      "type": "n8n-nodes-base.httpRequest",
      "typeVersion": 1,
      "position": [
        180,
        300
      ],
      "id": "b191d0e0-6ef8-4e36-9371-337535e5c09f"
    },
    {
      "parameters": {
        "functionCode": "return items[0].json.items.map(repo => {\\n  return {\\n    json: {\\n      name: repo.name,\\n      url: repo.html_url,\\n      description: repo.description,\\n      stars: repo.stargazers_count,\\n      language: repo.language,\\n    },\\n  };\\n});"
      },
      "name": "Format Output",
      "type": "n8n-nodes-base.function",
      "typeVersion": 1,
      "position": [
        -460,
        540
      ],
      "id": "f6e5659c-3d35-422e-adf4-e43f4a8da231"
    },
    {
      "parameters": {
        "triggerTimes": {
          "item": [
            {
              "mode": "everyWeek",
              "hour": 0
            }
          ]
        }
      },
      "name": "Weekly Trigger",
      "type": "n8n-nodes-base.cron",
      "typeVersion": 1,
      "position": [
        -460,
        300
      ],
      "id": "f55ed4e7-2623-433b-8080-a7e36f0d7e5a"
    },
    {
      "parameters": {
        "content": "## 取得notion資料",
        "width": 340
      },
      "type": "n8n-nodes-base.stickyNote",
      "typeVersion": 1,
      "position": [
        -480,
        260
      ],
      "id": "e116a26b-ee95-42f6-9d6d-8f6bc705981f",
      "name": "Sticky Note"
    },
    {
      "parameters": {
        "content": "## 讀取時間與GITHUB資料",
        "width": 380
      },
      "type": "n8n-nodes-base.stickyNote",
      "typeVersion": 1,
      "position": [
        -60,
        260
      ],
      "id": "c6a69953-f29a-400b-a21b-e3c9eecb6ffe",
      "name": "Sticky Note1"
    },
    {
      "parameters": {
        "content": "## 格式化輸出與一筆一筆資料吐出",
        "width": 380
      },
      "type": "n8n-nodes-base.stickyNote",
      "typeVersion": 1,
      "position": [
        -480,
        500
      ],
      "id": "f09c4447-973b-4c01-b54f-98f2a500361c",
      "name": "Sticky Note2"
    },
    {
      "parameters": {
        "content": "## 過濾單一資料\\n",
        "width": 180,
        "color": 3
      },
      "type": "n8n-nodes-base.stickyNote",
      "typeVersion": 1,
      "position": [
        -80,
        500
      ],
      "id": "5df8b062-3fa0-4ec2-a7e7-1184a2b9bdbf",
      "name": "Sticky Note3"
    },
    {
      "parameters": {
        "content": "## 轉換資料並給予AI輸出",
        "width": 440
      },
      "type": "n8n-nodes-base.stickyNote",
      "typeVersion": 1,
      "position": [
        120,
        500
      ],
      "id": "c00805a3-198c-4160-9f1f-a986dbdc5731",
      "name": "Sticky Note4"
    },
    {
      "parameters": {
        "resource": "Default",
        "operation": "Scrape A Url And Get Its Content",
        "url": "={{ $json.url }}",
        "formats": [
          "markdown"
        ],
        "requestOptions": {}
      },
      "type": "n8n-nodes-firecrawl.fireCrawl",
      "typeVersion": 1,
      "position": [
        180,
        540
      ],
      "id": "110e2fac-696a-4219-889a-7bb744073d84",
      "name": "FireCrawl",
      "credentials": {
        "fireCrawlApi": {
          "id": "54xic1SRukrtOUGd",
          "name": "FireCrawl account"
        }
      }
    }
  ],
  "connections": {
    "OpenAI": {
      "main": [
        [
          {
            "node": "Add New Record to Notion",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "SplitInBatches": {
      "main": [
        [
          {
            "node": "Filter Unique Records",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Get Existing Records": {
      "main": [
        [
          {
            "node": "Generate Week Range",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Filter Unique Records": {
      "main": [
        [
          {
            "node": "FireCrawl",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Generate Week Range": {
      "main": [
        [
          {
            "node": "Fetch Weekly Repos",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Fetch Weekly Repos": {
      "main": [
        [
          {
            "node": "Format Output",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Format Output": {
      "main": [
        [
          {
            "node": "SplitInBatches",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Weekly Trigger": {
      "main": [
        [
          {
            "node": "Get Existing Records",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "FireCrawl": {
      "main": [
        [
          {
            "node": "OpenAI",
            "type": "main",
            "index": 0
          }
        ]
      ]
    }
  },
  "pinData": {},
  "meta": {
    "templateCredsSetupCompleted": true,
    "instanceId": "b4675dd1a7ebe0e31fae9b043df25c973d6121b6f98cd79084b3ea3b081c6fe8"
  }
}

2025/03/16改版

image.png

{
  "nodes": [
    {
      "parameters": {
        "options": {
          "reset": true
        }
      },
      "name": "SplitInBatches",
      "type": "n8n-nodes-base.splitInBatches",
      "typeVersion": 1,
      "position": [
        -280,
        540
      ],
      "id": "60c931ab-0be4-4d38-977a-88366e114a3e"
    },
    {
      "parameters": {
        "resource": "databasePage",
        "operation": "getAll",
        "databaseId": {
          "__rl": true,
          "value": "182d3705-f69e-8053-9d5a-ea5b03411e09",
          "mode": "list",
          "cachedResultName": "giphub每周熱點",
          "cachedResultUrl": "<https://www.notion.so/182d3705f69e80539d5aea5b03411e09>"
        },
        "returnAll": true,
        "simple": false,
        "filterType": "manual",
        "filters": {
          "conditions": [
            {
              "key": "姓名|rich_text",
              "condition": "equals",
              "richTextValue": "123"
            }
          ]
        },
        "options": {}
      },
      "name": "Get Existing Records",
      "type": "n8n-nodes-base.notion",
      "typeVersion": 2,
      "position": [
        -260,
        300
      ],
      "id": "7e025c5f-b5ae-45a2-9fd3-ba777a0d8153",
      "executeOnce": true,
      "credentials": {
        "notionApi": {
          "id": "mLkW1oHj5qZYbd3M",
          "name": "Notion account"
        }
      }
    },
    {
      "parameters": {
        "conditions": {
          "string": [
            {
              "value1": "={{ $json[\\"URL\\"] }}",
              "operation": "notContains",
              "value2": "={{ $('Get Existing Records').item.json.properties['姓名'].rich_text[0].plain_text }}"
            }
          ]
        }
      },
      "name": "Filter Unique Records",
      "type": "n8n-nodes-base.if",
      "typeVersion": 1,
      "position": [
        -40,
        540
      ],
      "id": "28a83b64-5b73-48e8-84d0-ef4ee1081522"
    },
    {
      "parameters": {
        "functionCode": "const now = new Date();\\nconst endDate = new Date(now.setDate(now.getDate() - now.getDay() - 1)); // 上周日\\nconst startDate = new Date(endDate);\\nstartDate.setDate(endDate.getDate() - 6); // 上周一\\n\\nconst start = startDate.toISOString().split('T')[0];\\nconst end = endDate.toISOString().split('T')[0];\\n\\n// 返回開始和結束日期以及完整的 URL\\nreturn [\\n  {\\n    json: {\\n      startDate: start,\\n      endDate: end,\\n      queryUrl: `https://api.github.com/search/repositories?q=stars:>0+created:${start}..${end}&sort=stars&order=desc&per_page=10`,\\n    },\\n  },\\n];"
      },
      "name": "Generate Week Range",
      "type": "n8n-nodes-base.function",
      "typeVersion": 1,
      "position": [
        -40,
        300
      ],
      "id": "ef0af992-7c48-42f1-90b0-bfe7f188aa11"
    },
    {
      "parameters": {
        "url": "={{$json[\\"queryUrl\\"]}}",
        "allowUnauthorizedCerts": true,
        "options": {}
      },
      "name": "Fetch Weekly Repos",
      "type": "n8n-nodes-base.httpRequest",
      "typeVersion": 1,
      "position": [
        180,
        300
      ],
      "id": "b191d0e0-6ef8-4e36-9371-337535e5c09f"
    },
    {
      "parameters": {
        "functionCode": "return items[0].json.items.map(repo => {\\n  return {\\n    json: {\\n      name: repo.name,\\n      url: repo.html_url,\\n      description: repo.description,\\n      stars: repo.stargazers_count,\\n      language: repo.language,\\n    },\\n  };\\n});"
      },
      "name": "Format Output",
      "type": "n8n-nodes-base.function",
      "typeVersion": 1,
      "position": [
        -460,
        540
      ],
      "id": "f6e5659c-3d35-422e-adf4-e43f4a8da231"
    },
    {
      "parameters": {
        "triggerTimes": {
          "item": [
            {
              "mode": "everyWeek",
              "hour": 0
            }
          ]
        }
      },
      "name": "Weekly Trigger",
      "type": "n8n-nodes-base.cron",
      "typeVersion": 1,
      "position": [
        -460,
        300
      ],
      "id": "f55ed4e7-2623-433b-8080-a7e36f0d7e5a"
    },
    {
      "parameters": {
        "content": "## 取得notion資料",
        "width": 340
      },
      "type": "n8n-nodes-base.stickyNote",
      "typeVersion": 1,
      "position": [
        -480,
        260
      ],
      "id": "e116a26b-ee95-42f6-9d6d-8f6bc705981f",
      "name": "Sticky Note"
    },
    {
      "parameters": {
        "content": "## 讀取時間與GITHUB資料",
        "width": 380
      },
      "type": "n8n-nodes-base.stickyNote",
      "typeVersion": 1,
      "position": [
        -60,
        260
      ],
      "id": "c6a69953-f29a-400b-a21b-e3c9eecb6ffe",
      "name": "Sticky Note1"
    },
    {
      "parameters": {
        "content": "## 格式化輸出與一筆一筆資料吐出",
        "width": 380
      },
      "type": "n8n-nodes-base.stickyNote",
      "typeVersion": 1,
      "position": [
        -480,
        500
      ],
      "id": "f09c4447-973b-4c01-b54f-98f2a500361c",
      "name": "Sticky Note2"
    },
    {
      "parameters": {
        "content": "## 過濾單一資料\\n",
        "width": 180,
        "color": 3
      },
      "type": "n8n-nodes-base.stickyNote",
      "typeVersion": 1,
      "position": [
        -80,
        500
      ],
      "id": "5df8b062-3fa0-4ec2-a7e7-1184a2b9bdbf",
      "name": "Sticky Note3"
    },
    {
      "parameters": {
        "content": "## 轉換資料並給予AI輸出",
        "width": 440
      },
      "type": "n8n-nodes-base.stickyNote",
      "typeVersion": 1,
      "position": [
        120,
        500
      ],
      "id": "c00805a3-198c-4160-9f1f-a986dbdc5731",
      "name": "Sticky Note4"
    },
    {
      "parameters": {
        "resource": "Default",
        "operation": "Scrape A Url And Get Its Content",
        "url": "={{ $json.url }}",
        "formats": [
          "markdown"
        ],
        "requestOptions": {}
      },
      "type": "n8n-nodes-firecrawl.fireCrawl",
      "typeVersion": 1,
      "position": [
        180,
        540
      ],
      "id": "110e2fac-696a-4219-889a-7bb744073d84",
      "name": "FireCrawl",
      "credentials": {
        "fireCrawlApi": {
          "id": "hBqSpu4IEK9Lao6W",
          "name": "FireCrawl account 3"
        }
      }
    },
    {
      "parameters": {
        "resource": "databasePage",
        "databaseId": {
          "__rl": true,
          "value": "182d3705-f69e-8053-9d5a-ea5b03411e09",
          "mode": "list",
          "cachedResultName": "giphub每周熱點",
          "cachedResultUrl": "<https://www.notion.so/182d3705f69e80539d5aea5b03411e09>"
        },
        "title": "=影片",
        "propertiesUi": {
          "propertyValues": [
            {
              "key": "網址|rich_text",
              "textContent": "={{ $('Format Output').item.json.url }}"
            },
            {
              "key": "描述|rich_text",
              "textContent": "={{ $('Format Output').item.json.description && $('Format Output').item.json.description.trim() !== '' ? $('Format Output').item.json.description : '沒有描述' }}\\n"
            },
            {
              "key": "姓名|rich_text",
              "textContent": "={{ $('Format Output').item.json.name }}"
            },
            {
              "key": "GPT輸出|rich_text",
              "textContent": "={{ $json.text }}"
            },
            {
              "key": "time|rich_text",
              "textContent": "={{ $('Generate Week Range').item.json.startDate }}-{{ $('Generate Week Range').item.json.endDate }}"
            },
            {
              "key": "⭐⭐|rich_text",
              "textContent": "={{ $('Format Output').item.json.stars.toString() }}"
            }
          ]
        },
        "options": {}
      },
      "name": "Add New Record to Notion",
      "type": "n8n-nodes-base.notion",
      "typeVersion": 2,
      "position": [
        740,
        540
      ],
      "id": "2b2bb6e9-2715-454c-af48-29816540d524",
      "credentials": {
        "notionApi": {
          "id": "mLkW1oHj5qZYbd3M",
          "name": "Notion account"
        }
      }
    },
    {
      "parameters": {
        "promptType": "define",
        "text": "=",
        "messages": {
          "messageValues": [
            {
              "message": "={{ $('Get Existing Records').item.json.properties['要求'].multi_select[0].name }}"
            },
            {
              "type": "HumanMessagePromptTemplate",
              "message": "={{ $json.data.markdown }}"
            }
          ]
        }
      },
      "type": "@n8n/n8n-nodes-langchain.chainLlm",
      "typeVersion": 1.5,
      "position": [
        360,
        540
      ],
      "id": "58c623f7-6cdc-4f6b-b282-dbaca530c3a6",
      "name": "Basic LLM Chain"
    },
    {
      "parameters": {
        "options": {}
      },
      "type": "@n8n/n8n-nodes-langchain.lmChatDeepSeek",
      "typeVersion": 1,
      "position": [
        360,
        720
      ],
      "id": "cac0557f-d4d5-4b47-9b96-d33b05620dc9",
      "name": "DeepSeek Chat Model",
      "credentials": {
        "deepSeekApi": {
          "id": "CQTsDcujqKv9f20p",
          "name": "DeepSeek account"
        }
      }
    }
  ],
  "connections": {
    "SplitInBatches": {
      "main": [
        [
          {
            "node": "Filter Unique Records",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Get Existing Records": {
      "main": [
        [
          {
            "node": "Generate Week Range",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Filter Unique Records": {
      "main": [
        [
          {
            "node": "FireCrawl",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Generate Week Range": {
      "main": [
        [
          {
            "node": "Fetch Weekly Repos",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Fetch Weekly Repos": {
      "main": [
        [
          {
            "node": "Format Output",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Format Output": {
      "main": [
        [
          {
            "node": "SplitInBatches",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Weekly Trigger": {
      "main": [
        [
          {
            "node": "Get Existing Records",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "FireCrawl": {
      "main": [
        [
          {
            "node": "Basic LLM Chain",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Basic LLM Chain": {
      "main": [
        [
          {
            "node": "Add New Record to Notion",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "DeepSeek Chat Model": {
      "ai_languageModel": [
        [
          {
            "node": "Basic LLM Chain",
            "type": "ai_languageModel",
            "index": 0
          }
        ]
      ]
    }
  },
  "pinData": {},
  "meta": {
    "templateCredsSetupCompleted": true,
    "instanceId": "b4675dd1a7ebe0e31fae9b043df25c973d6121b6f98cd79084b3ea3b081c6fe8"
  }
}