AutomationFlowsWeb Scraping › Automated Sonarr Missing Episode Finder with Quality & Language Filtering

Automated Sonarr Missing Episode Finder with Quality & Language Filtering

ByNícolas Pastorello @opastorello on n8n.io

What is this? This is an n8n workflow designed to supercharge your Sonarr setup. Instead of just waiting for releases to appear in your RSS feed, this workflow proactively runs on a schedule, finds what's missing, actively searches for it, and grabs the best result based on your…

Cron / scheduled trigger★★★★☆ complexity10 nodesHTTP Request
Web Scraping Trigger: Cron / scheduled Nodes: 10 Complexity: ★★★★☆ Added:

This workflow corresponds to n8n.io template #5927 — we link there as the canonical source.

The workflow JSON

Copy or download the full n8n JSON below. Paste it into a new n8n workflow, add your credentials, activate. Full import guide →

Download .json
{
  "nodes": [
    {
      "id": "b7575322-a8cd-48b1-8989-59e8c10f3fb3",
      "name": "info",
      "type": "n8n-nodes-base.set",
      "position": [
        -220,
        100
      ],
      "parameters": {
        "options": {},
        "assignments": {
          "assignments": [
            {
              "id": "e03dba6d-c6c4-407b-b65b-15aacb8a4a32",
              "name": "urlSonar",
              "type": "string",
              "value": "http://0.0.0.0:8989"
            },
            {
              "id": "976f2fe4-2d27-43f7-8fba-5f992ab0894e",
              "name": "apikey",
              "type": "string",
              "value": "j7oi8oiji7yih85765tg646ghft6ffd6"
            },
            {
              "id": "00cdb214-7b97-4037-aca9-36569403b340",
              "name": "quality",
              "type": "string",
              "value": "WEBDL-1080p"
            },
            {
              "id": "01c442c9-3ecb-43b1-a112-3cd41c62b232",
              "name": "languages",
              "type": "string",
              "value": "Portuguese (Brazil)"
            }
          ]
        }
      },
      "typeVersion": 3.4
    },
    {
      "id": "bdd74c08-4891-4c55-81a6-1da3c72e8ef5",
      "name": "Edit Fields",
      "type": "n8n-nodes-base.set",
      "position": [
        220,
        100
      ],
      "parameters": {
        "options": {},
        "assignments": {
          "assignments": [
            {
              "id": "598bf523-e5f2-4976-9b66-35e2918d9bdd",
              "name": "records",
              "type": "array",
              "value": "={{ $json.records }}"
            }
          ]
        }
      },
      "typeVersion": 3.4
    },
    {
      "id": "8b898b4a-8a53-48cc-8917-2c406e64c95f",
      "name": "Split Out",
      "type": "n8n-nodes-base.splitOut",
      "position": [
        440,
        100
      ],
      "parameters": {
        "options": {},
        "fieldToSplitOut": "records"
      },
      "typeVersion": 1
    },
    {
      "id": "117443a3-7a83-4c50-a4af-693c11dd6e3c",
      "name": "Schedule Trigger",
      "type": "n8n-nodes-base.scheduleTrigger",
      "position": [
        -440,
        100
      ],
      "parameters": {
        "rule": {
          "interval": [
            {
              "field": "hours",
              "hoursInterval": 12
            }
          ]
        }
      },
      "typeVersion": 1.2
    },
    {
      "id": "55253fdd-9f78-428d-8fd4-d5f4b74c78ef",
      "name": "Override and add to download queue",
      "type": "n8n-nodes-base.httpRequest",
      "onError": "continueErrorOutput",
      "maxTries": 3,
      "position": [
        1100,
        -100
      ],
      "parameters": {
        "url": "={{ $('info').item.json.urlSonar }}/api/v3/release",
        "method": "POST",
        "options": {},
        "jsonBody": "={{ \n  JSON.stringify({\n    indexerId: $('Loop Over Items').item.json.indexerId,\n    guid: $('Loop Over Items').item.json.guid,\n    seriesId: $('Loop Over Items').item.json.mappedSeriesId,\n    episodeIds: $('Loop Over Items').item.json.mappedEpisodeInfo.map(e => e.id),\n    quality: {\n      quality: {\n        id: $('Loop Over Items').item.json.quality.quality.id,\n        name: $('Loop Over Items').item.json.quality.quality.name,\n        source: $('Loop Over Items').item.json.quality.quality.source,\n        resolution: $('Loop Over Items').item.json.quality.quality.resolution\n      },\n      revision: {\n        version: $('Loop Over Items').item.json.quality.revision.version,\n        real: $('Loop Over Items').item.json.quality.revision.real,\n        isRepack: $('Loop Over Items').item.json.quality.revision.isRepack\n      }\n    },\n    languages: [\n      {\n        id: $('Loop Over Items').item.json.languages[0].id,\n        name: $('Loop Over Items').item.json.languages[0].name\n      }\n    ],\n    downloadClientId: null,\n    shouldOverride: true\n  })\n}}\n",
        "sendBody": true,
        "sendQuery": true,
        "specifyBody": "json",
        "queryParameters": {
          "parameters": [
            {
              "name": "apikey",
              "value": "={{ $('info').item.json.apikey }}"
            },
            {}
          ]
        }
      },
      "retryOnFail": true,
      "typeVersion": 4.2,
      "alwaysOutputData": false
    },
    {
      "id": "da00208f-c5f7-4276-8c66-af5566e387ad",
      "name": "Interactive search for all episodes in this season",
      "type": "n8n-nodes-base.httpRequest",
      "position": [
        1100,
        100
      ],
      "parameters": {
        "url": "={{ $('info').item.json.urlSonar }}/api/v3/release",
        "options": {},
        "sendQuery": true,
        "queryParameters": {
          "parameters": [
            {
              "name": "seriesId",
              "value": "={{ $('Split Out').item.json.seriesId }}"
            },
            {
              "name": "seasonNumber",
              "value": "={{ $('Split Out').item.json.seasonNumber }}"
            },
            {
              "name": "apikey",
              "value": "={{ $('info').item.json.apikey }}"
            }
          ]
        }
      },
      "executeOnce": true,
      "notesInFlow": false,
      "typeVersion": 4.2
    },
    {
      "id": "df7c8bf5-ecc7-4af7-8668-6c47cc86bdf9",
      "name": "Check for Missing Episodes",
      "type": "n8n-nodes-base.httpRequest",
      "position": [
        0,
        100
      ],
      "parameters": {
        "url": "={{ $('info').item.json.urlSonar }}/api/v3/wanted/missing",
        "options": {},
        "sendQuery": true,
        "sendHeaders": true,
        "queryParameters": {
          "parameters": [
            {
              "name": "page",
              "value": "1"
            },
            {
              "name": "pageSize",
              "value": "100"
            },
            {
              "name": "sortDirection",
              "value": "descending"
            },
            {
              "name": "includeSeries",
              "value": "false"
            },
            {
              "name": "includeImages",
              "value": "false"
            },
            {
              "name": "monitored",
              "value": "true"
            },
            {
              "name": "apikey",
              "value": "={{ $('info').item.json.apikey }}"
            }
          ]
        },
        "headerParameters": {
          "parameters": [
            {
              "name": "accept",
              "value": "application/json"
            }
          ]
        }
      },
      "executeOnce": false,
      "typeVersion": 4.2
    },
    {
      "id": "971e172b-1961-41b3-ad0b-0936e7a2c591",
      "name": "Validate Quality and Language Match",
      "type": "n8n-nodes-base.if",
      "position": [
        1320,
        175
      ],
      "parameters": {
        "options": {},
        "conditions": {
          "options": {
            "version": 2,
            "leftValue": "",
            "caseSensitive": true,
            "typeValidation": "strict"
          },
          "combinator": "and",
          "conditions": [
            {
              "id": "faa46e5b-40ef-4200-9827-50e7d7666f24",
              "operator": {
                "name": "filter.operator.equals",
                "type": "string",
                "operation": "equals"
              },
              "leftValue": "={{ $json.quality.quality.name }}",
              "rightValue": "={{ $('info').item.json.quality }}"
            },
            {
              "id": "6caeb8cc-f152-497b-9f6b-4a6526c3df00",
              "operator": {
                "name": "filter.operator.equals",
                "type": "string",
                "operation": "equals"
              },
              "leftValue": "={{ $json.languages[0].name }}",
              "rightValue": "={{ $('info').item.json.languages }}"
            }
          ]
        }
      },
      "executeOnce": false,
      "typeVersion": 2.2
    },
    {
      "id": "7ef44e0f-65a9-4579-9599-de626165d022",
      "name": "Filter Series",
      "type": "n8n-nodes-base.code",
      "position": [
        660,
        100
      ],
      "parameters": {
        "jsCode": "const seenSeasons = new Set();\nconst uniqueItems = [];\n\nfor (const item of $input.all()) {\n  const key = `${item.json.seriesId}-${item.json.seasonNumber}`;\n\n  if (!seenSeasons.has(key)) {\n    item.json.myNewField = 1;\n    uniqueItems.push(item);\n    seenSeasons.add(key);\n  }\n}\n\nuniqueItems.sort((a, b) => {\n  if (a.json.seriesId !== b.json.seriesId) {\n    return a.json.seriesId - b.json.seriesId;\n  }\n  return a.json.seasonNumber - b.json.seasonNumber;\n});\n\nreturn uniqueItems;"
      },
      "typeVersion": 2
    },
    {
      "id": "3bf70dc2-c110-44b8-a9b1-59c3f8ce7e01",
      "name": "Loop Over Items",
      "type": "n8n-nodes-base.splitInBatches",
      "position": [
        880,
        100
      ],
      "parameters": {
        "options": {}
      },
      "typeVersion": 3
    }
  ],
  "connections": {
    "info": {
      "main": [
        [
          {
            "node": "Check for Missing Episodes",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Split Out": {
      "main": [
        [
          {
            "node": "Filter Series",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Edit Fields": {
      "main": [
        [
          {
            "node": "Split Out",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Filter Series": {
      "main": [
        [
          {
            "node": "Loop Over Items",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Loop Over Items": {
      "main": [
        [
          {
            "node": "Override and add to download queue",
            "type": "main",
            "index": 0
          }
        ],
        [
          {
            "node": "Interactive search for all episodes in this season",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Schedule Trigger": {
      "main": [
        [
          {
            "node": "info",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Check for Missing Episodes": {
      "main": [
        [
          {
            "node": "Edit Fields",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Override and add to download queue": {
      "main": [
        [],
        []
      ]
    },
    "Validate Quality and Language Match": {
      "main": [
        [
          {
            "node": "Loop Over Items",
            "type": "main",
            "index": 0
          }
        ],
        []
      ]
    },
    "Interactive search for all episodes in this season": {
      "main": [
        [
          {
            "node": "Validate Quality and Language Match",
            "type": "main",
            "index": 0
          }
        ]
      ]
    }
  }
}
Pro

For the full experience including quality scoring and batch install features for each workflow upgrade to Pro

About this workflow

What is this? This is an n8n workflow designed to supercharge your Sonarr setup. Instead of just waiting for releases to appear in your RSS feed, this workflow proactively runs on a schedule, finds what's missing, actively searches for it, and grabs the best result based on your…

Source: https://n8n.io/workflows/5927/ — original creator credit. Request a take-down →

More Web Scraping workflows → · Browse all categories →

Related workflows

Workflows that share integrations, category, or trigger type with this one. All free to copy and import.

Web Scraping

As n8n instances scale, teams often lose track of sub-workflows—who uses them, where they are referenced, and whether they can be safely updated. This leads to inefficiencies like unnecessary copies o

HTTP Request, n8n, N8N Trigger +1
Web Scraping

This workflow is an improvement of this workflow by Greg Brzezinka.

HTTP Request, Email Send, XML +1
Web Scraping

N8N-Workflow-Github-Manager. Uses github, httpRequest, n8n. Scheduled trigger; 38 nodes.

GitHub, HTTP Request, n8n
Web Scraping

This workflow uses KlickTipp community nodes, available for self-hosted n8n instances only.

N8N Nodes Klicktipp, Salesforce, Salesforce Trigger +1
Web Scraping

This workflow acts as an automated engagement bot. It sends a Direct Message (DM) with a link or resource to any follower who replies to your post with a specific target keyword.

HTTP Request