{ "id": "aEtoKG8mIocULX5W", "name": "Audiobook Torrents", "nodes": [ { "parameters": {}, "type": "n8n-nodes-base.manualTrigger", "typeVersion": 1, "position": [ -736, -48 ], "id": "286acfc0-180f-407a-aa4a-f76683e5e061", "name": "When clicking 'Execute workflow'" }, { "parameters": { "url": "https://nyaa.si/?page=rss&q=%5BAudiobook%5D&c=3_1&f=0", "options": {} }, "type": "n8n-nodes-base.httpRequest", "typeVersion": 4.2, "position": [ -512, 48 ], "id": "c3a1b112-cd01-4a0e-b843-bd6c635202c6", "name": "HTTP Request" }, { "parameters": { "options": { "trim": true } }, "type": "n8n-nodes-base.xml", "typeVersion": 1, "position": [ -288, 48 ], "id": "0239b8cc-c0b0-4bce-9892-176bf69ab8aa", "name": "XML" }, { "parameters": { "fieldToSplitOut": "rss.channel.item", "options": {} }, "id": "split-items-node", "name": "Split Feed Items", "type": "n8n-nodes-base.splitOut", "typeVersion": 1, "position": [ -64, 48 ] }, { "parameters": { "jsCode": "// Process all input items and return them\nreturn $input.all().map(item => ({\n json: {\n info_hash: item.json['nyaa:infoHash'],\n title: item.json.title,\n link: item.json.link,\n view_link: item.json.guid._ || item.json.guid,\n pub_date: item.json.pubDate,\n seeders: parseInt(item.json['nyaa:seeders']) || 0,\n size: item.json['nyaa:size']\n }\n}));" }, "id": "extract-torrent-data", "name": "Extract Torrent Data", "type": "n8n-nodes-base.code", "typeVersion": 2, "position": [ 160, 48 ], "executeOnce": false }, { "parameters": { "conditions": { "conditions": [ { "leftValue": "={{ $json.seeders }}", "rightValue": 0, "operator": { "type": "number", "operation": "gt" } } ] }, "options": {} }, "id": "filter-has-seeders", "name": "Has Seeders?", "type": "n8n-nodes-base.if", "typeVersion": 2, "position": [ -592, 624 ] }, { "parameters": { "rule": { "interval": [ { "field": "minutes" } ] } }, "id": "schedule-trigger-5min", "name": "Every 5 Minutes", "type": "n8n-nodes-base.scheduleTrigger", "typeVersion": 1.2, "position": [ -736, 144 ] }, { "parameters": { "sendTo": "admin@ben.io", "subject": "={{ $json.torrentCount }} New Audiobook Torrent(s) Found", "message": "={{ $json.emailHtmlBody }}", "options": {} }, "id": "send-gmail-notification", "name": "Send Gmail Notification", "type": "n8n-nodes-base.gmail", "typeVersion": 2.1, "position": [ 896, 528 ], "webhookId": "8da5c0a8-d147-46e8-bcc5-85d5cd2c87d5", "credentials": { "gmailOAuth2": { "id": "Os1ux3h3zFlC2XkG", "name": "Gmail account" } } }, { "parameters": { "operation": "getAll", "tableId": "nyaa_audiobooks", "returnAll": true, "filterType": "none" }, "type": "n8n-nodes-base.supabase", "typeVersion": 1, "position": [ -368, 704 ], "id": "ea585083-0b0a-410b-b0ac-768badf335fa", "name": "Get many rows", "executeOnce": true, "credentials": { "supabaseApi": { "id": "lWyf2ikOGHTTwnSU", "name": "Supabase account" } } }, { "parameters": { "mergeByFields": { "values": [ { "field1": "info_hash", "field2": "info_hash" } ] }, "options": { "skipFields": "seeders,discovered_at,updated_at,mam_torrent_id,mam_checked_at,view_link,id,created_at,search_title,volume_range" } }, "type": "n8n-nodes-base.compareDatasets", "typeVersion": 2.3, "position": [ -144, 592 ], "id": "13fffea6-eb23-4746-9c21-e9695bd8c377", "name": "Compare Datasets" }, { "parameters": { "jsCode": "// Get all incoming items using $input.all()\nconst torrents = $input.all();\nconst count = torrents.length;\n\n// If no torrents, return empty to stop workflow\nif (count === 0) {\n return [];\n}\n\n// Helper function to get MAM status display\nfunction getMAMStatus(torrent) {\n if (torrent.mam_torrent_id) {\n return `✅ Yes`;\n } else {\n return '❌ No';\n }\n}\n\n// Build HTML table rows\nlet tableRows = \"\";\n\nfor (const item of torrents) {\n const torrent = item.json;\n \n tableRows += `\n
| Title | \nSeeders | \nSize | \nOn MAM? | \nLinks | \n
|---|