{
"id": "3",
"name": "rss-telegram",
"nodes": [
{
"name": "SplitInBatches",
"type": "n8n-nodes-base.splitInBatches",
"position": [
480,
220
],
"parameters": {
"batchSize": 1
},
"typeVersion": 1
},
{
"name": "Function",
"type": "n8n-nodes-base.function",
"position": [
610,
220
],
"parameters": {
"functionCode": "const staticData = getWorkflowStaticData('global');\n\n\/\/ Access its data\nconst oldlink = staticData.oldlink;\n\nitems[0].json.oldlink = oldlink || \"\";\n\n\/\/ Update its data\nstaticData.oldlink = items[0].json.link;\n\nreturn items;"
},
"typeVersion": 1
},
{
"name": "Cron1",
"type": "n8n-nodes-base.cron",
"position": [
180,
290
],
"parameters": {
"triggerTimes": {
"item": [
{
"mode": "everyMinute"
}
]
}
},
"typeVersion": 1
},
{
"name": "\u662f\u5426\u91cd\u590d",
"type": "n8n-nodes-base.if",
"notes": "\u5224\u65ad\u94fe\u63a5\u662f\u5426\u76f8\u540c",
"position": [
750,
220
],
"parameters": {
"conditions": {
"string": [
{
"value1": "={{$node[\"Function\"].data[\"oldlink\"]}}",
"value2": "={{$node[\"Function\"].data[\"link\"]}}"
}
]
}
},
"typeVersion": 1
},
{
"name": "\u5199\u5165\u56fe\u7247\u7684\u5c5e\u6027",
"type": "n8n-nodes-base.function",
"position": [
910,
220
],
"parameters": {
"functionCode": "function imgList(items) {\n let imgReg = \/<img.*?(?:>|\\\/>)\/gi \/\/\u5339\u914d\u56fe\u7247\u4e2d\u7684img\u6807\u7b7e\n let srcReg = \/src=[\\'\\\"]?([^\\'\\\"]*)[\\'\\\"]?\/i \/\/ \u5339\u914d\u56fe\u7247\u4e2d\u7684src\n let str = items[0].json.content\n let arr = str.match(imgReg) \/\/\u7b5b\u9009\u51fa\u6240\u6709\u7684img\n let srcArr = []\n if(arr !== null){\n for (let i = 0; i < arr.length; i++) {\n let src = arr[i].match(srcReg)\n \/\/ \u83b7\u53d6\u56fe\u7247\u5730\u5740\n srcArr.push(src[1])\n }\n items[0].json.arrlength = arr.length;\n items[0].json.imgList = srcArr;\n } else {\n items[0].json.arrlength = 0;\n }\n \n }\nimgList(items)\nreturn items;"
},
"typeVersion": 1
},
{
"name": "\u56fe\u7247\u6570\u91cf\u5224\u65ad",
"type": "n8n-nodes-base.if",
"position": [
1060,
220
],
"parameters": {
"conditions": {
"number": [
{
"value1": "={{$node[\"\u5199\u5165\u56fe\u7247\u7684\u5c5e\u6027\"].data[\"arrlength\"]}}",
"value2": 1,
"operation": "equal"
}
],
"string": [],
"boolean": []
}
},
"typeVersion": 1
},
{
"name": "\u4e00\u5f20\u56fe\u7247",
"type": "n8n-nodes-base.telegram",
"position": [
1270,
80
],
"parameters": {
"file": "={{$node[\"\u56fe\u7247\u6570\u91cf\u5224\u65ad\"].data[\"imgList\"][0]}}",
"chatId": "-1001314058276",
"operation": "sendPhoto",
"additionalFields": {
"caption": "={{$node[\"\u56fe\u7247\u6570\u91cf\u5224\u65ad\"].data[\"contentSnippet\"]}}"
}
},
"credentials": {
"telegramApi": "lataimei"
},
"typeVersion": 1
},
{
"name": "\u5176\u4ed6\u72b6\u51b5",
"type": "n8n-nodes-base.telegram",
"notes": "\u65e0\u56fe\u7247",
"position": [
1270,
230
],
"parameters": {
"text": "={{$node[\"\u56fe\u7247\u6570\u91cf\u5224\u65ad\"].data[\"contentSnippet\"]}} {{$node[\"\u56fe\u7247\u6570\u91cf\u5224\u65ad\"].data[\"link\"]}}",
"chatId": "-1001314058276",
"additionalFields": {
"parse_mode": "HTML",
"disable_web_page_preview": true
}
},
"credentials": {
"telegramApi": "lataimei"
},
"typeVersion": 1
},
{
"name": "NaN",
"type": "n8n-nodes-base.function",
"position": [
910,
370
],
"parameters": {
"functionCode": "function imgList(items) {\n let imgReg = \/<img.*?(?:>|\\\/>)\/gi \/\/\u5339\u914d\u56fe\u7247\u4e2d\u7684img\u6807\u7b7e\n let srcReg = \/src=[\\'\\\"]?([^\\'\\\"]*)[\\'\\\"]?\/i \/\/ \u5339\u914d\u56fe\u7247\u4e2d\u7684src\n let str = items[0].json.content\n let arr = str.match(imgReg) \/\/\u7b5b\u9009\u51fa\u6240\u6709\u7684img\n let srcArr = []\n if(arr !== null){\n for (let i = 0; i < arr.length; i++) {\n let src = arr[i].match(srcReg)\n \/\/ \u83b7\u53d6\u56fe\u7247\u5730\u5740\n srcArr.push(src[1])\n }\n items[0].json.arrlength = arr.length;\n items[0].json.imgList = srcArr;\n } else {\n items[0].json.arrlength = 0;\n }\n \n }\nimgList(items)\nreturn items;"
},
"typeVersion": 1
},
{
"name": "SplitInBatches1",
"type": "n8n-nodes-base.splitInBatches",
"position": [
480,
370
],
"parameters": {
"batchSize": 1
},
"typeVersion": 1
},
{
"name": "Function1",
"type": "n8n-nodes-base.function",
"position": [
610,
370
],
"parameters": {
"functionCode": "const staticData = getWorkflowStaticData('global');\n\n\/\/ Access its data\nconst tsaioldlink = staticData.tsaioldlink;\n\nitems[0].json.tsaioldlink = tsaioldlink || \"\";\n\n\/\/ Update its data\nstaticData.tsaioldlink = items[0].json.link;\n\nreturn items;"
},
"typeVersion": 1
},
{
"name": "IF",
"type": "n8n-nodes-base.if",
"position": [
750,
370
],
"parameters": {
"conditions": {
"string": [
{
"value1": "={{$node[\"Function1\"].data[\"tsaioldlink\"]}}",
"value2": "={{$node[\"Function1\"].data[\"link\"]}}"
}
]
}
},
"typeVersion": 1
},
{
"name": "IF1",
"type": "n8n-nodes-base.if",
"position": [
1060,
370
],
"parameters": {
"conditions": {
"number": [
{
"value1": 1,
"value2": "=0",
"operation": "equal"
}
]
}
},
"typeVersion": 1
},
{
"name": "send",
"type": "n8n-nodes-base.telegram",
"notes": "\u65e0\u56fe\u7247",
"position": [
1270,
380
],
"parameters": {
"file": "={{$node[\"IF1\"].data[\"imgList\"][0]}}",
"chatId": "-1001499587010",
"operation": "sendPhoto",
"additionalFields": {
"caption": "={{$node[\"IF1\"].data[\"contentSnippet\"]}}"
}
},
"credentials": {
"telegramApi": "lataimei"
},
"typeVersion": 1
},
{
"name": "instagram rss",
"type": "n8n-nodes-base.rssFeedRead",
"position": [
360,
370
],
"parameters": {
"url": "=https:\/\/rsshub985.herokuapp.com\/instagram\/user\/tsai_ingwen\/"
},
"typeVersion": 1
},
{
"name": "weibo rss",
"type": "n8n-nodes-base.rssFeedRead",
"position": [
360,
220
],
"parameters": {
"url": "=https:\/\/rsshub985.herokuapp.com\/weibo\/user\/5721376081"
},
"typeVersion": 1
},
{
"name": "Telegram",
"type": "n8n-nodes-base.telegram",
"position": [
1270,
530
],
"parameters": {
"file": "={{$node[\"IF1\"].data[\"imgList\"][0]}}",
"chatId": "-1001499587010",
"operation": "sendPhoto",
"additionalFields": {
"caption": "={{$node[\"IF1\"].data[\"contentSnippet\"]}} {{$node[\"IF1\"].data[\"link\"]}}"
}
},
"credentials": {
"telegramApi": "lataimei"
},
"typeVersion": 1
},
{
"name": "test",
"type": "n8n-nodes-base.manualTrigger",
"position": [
180,
130
],
"parameters": [],
"typeVersion": 1
}
],
"active": true,
"settings": [],
"connections": {
"IF": {
"main": [
[],
[
{
"node": "NaN",
"type": "main",
"index": 0
}
]
]
},
"IF1": {
"main": [
[
{
"node": "send",
"type": "main",
"index": 0
}
],
[
{
"node": "Telegram",
"type": "main",
"index": 0
}
]
]
},
"NaN": {
"main": [
[
{
"node": "IF1",
"type": "main",
"index": 0
}
]
]
},
"test": {
"main": [
[
{
"node": "instagram rss",
"type": "main",
"index": 0
},
{
"node": "weibo rss",
"type": "main",
"index": 0
}
]
]
},
"Cron1": {
"main": [
[
{
"node": "weibo rss",
"type": "main",
"index": 0
},
{
"node": "instagram rss",
"type": "main",
"index": 0
}
]
]
},
"Function": {
"main": [
[
{
"node": "\u662f\u5426\u91cd\u590d",
"type": "main",
"index": 0
}
]
]
},
"Function1": {
"main": [
[
{
"node": "IF",
"type": "main",
"index": 0
}
]
]
},
"weibo rss": {
"main": [
[
{
"node": "SplitInBatches",
"type": "main",
"index": 0
}
]
]
},
"\u662f\u5426\u91cd\u590d": {
"main": [
[],
[
{
"node": "\u5199\u5165\u56fe\u7247\u7684\u5c5e\u6027",
"type": "main",
"index": 0
}
]
]
},
"instagram rss": {
"main": [
[
{
"node": "SplitInBatches1",
"type": "main",
"index": 0
}
]
]
},
"SplitInBatches": {
"main": [
[
{
"node": "Function",
"type": "main",
"index": 0
}
]
]
},
"SplitInBatches1": {
"main": [
[
{
"node": "Function1",
"type": "main",
"index": 0
}
]
]
},
"\u56fe\u7247\u6570\u91cf\u5224\u65ad": {
"main": [
[
{
"node": "\u4e00\u5f20\u56fe\u7247",
"type": "main",
"index": 0
}
],
[
{
"node": "\u5176\u4ed6\u72b6\u51b5",
"type": "main",
"index": 0
}
]
]
},
"\u5199\u5165\u56fe\u7247\u7684\u5c5e\u6027": {
"main": [
[
{
"node": "\u56fe\u7247\u6570\u91cf\u5224\u65ad",
"type": "main",
"index": 0
}
]
]
}
}
}